@@ -343,11 +343,43 @@ def test_hist2d(self):
343
343
fig , ax = plt .subplots ()
344
344
ax .hist2d (...)
345
345
346
- @pytest .mark .xfail (reason = "Test for hlines not written yet" )
347
346
@mpl .style .context ("default" )
348
347
def test_hlines (self ):
349
- fig , ax = plt .subplots ()
350
- ax .hlines (...)
348
+ mpl .rcParams ["date.converter" ] = 'concise'
349
+ fig , axs = plt .subplots (2 , 4 , layout = 'constrained' )
350
+ dateStrs = ['2023-03-08' ,
351
+ '2023-04-09' ,
352
+ '2023-05-13' ,
353
+ '2023-07-28' ,
354
+ '2023-12-24' ]
355
+ dates = [datetime .datetime (2023 , m * 2 , 10 ) for m in range (1 , 6 )]
356
+ date_start = [datetime .datetime (2023 , 6 , d ) for d in range (5 , 30 , 5 )]
357
+ date_end = [datetime .datetime (2023 , 7 , d ) for d in range (5 , 30 , 5 )]
358
+ npDates = [np .datetime64 (s ) for s in dateStrs ]
359
+ axs [0 , 0 ].hlines (y = dates ,
360
+ xmin = [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ],
361
+ xmax = [0.5 , 0.6 , 0.7 , 0.8 , 0.9 ])
362
+ axs [0 , 1 ].hlines (dates ,
363
+ xmin = datetime .datetime (2020 , 5 , 10 ),
364
+ xmax = datetime .datetime (2020 , 5 , 31 ))
365
+ axs [0 , 2 ].hlines (dates ,
366
+ xmin = date_start ,
367
+ xmax = date_end )
368
+ axs [0 , 3 ].hlines (dates ,
369
+ xmin = 0.45 ,
370
+ xmax = 0.65 )
371
+ axs [1 , 0 ].hlines (y = npDates ,
372
+ xmin = [0.5 , 0.6 , 0.7 , 0.8 , 0.9 ],
373
+ xmax = [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ])
374
+ axs [1 , 2 ].hlines (y = npDates ,
375
+ xmin = date_start ,
376
+ xmax = date_end )
377
+ axs [1 , 1 ].hlines (npDates ,
378
+ xmin = datetime .datetime (2020 , 5 , 10 ),
379
+ xmax = datetime .datetime (2020 , 5 , 31 ))
380
+ axs [1 , 3 ].hlines (npDates ,
381
+ xmin = 0.45 ,
382
+ xmax = 0.65 )
351
383
352
384
@pytest .mark .xfail (reason = "Test for imshow not written yet" )
353
385
@mpl .style .context ("default" )
0 commit comments