@@ -380,6 +380,25 @@ def test_subplots_timeseries(self):
380
380
self ._check_ticks_props (ax , xlabelsize = 7 , xrot = 45 ,
381
381
ylabelsize = 7 )
382
382
383
+ def test_subplots_timeseries_y_axis (self ):
384
+ # tests for fix of issue #16953
385
+ testdata = DataFrame ({"numeric" : np .array ([1 , 2 , 5 ]),
386
+ "timedelta" : [pd .Timedelta (10 , unit = "s" ),
387
+ pd .Timedelta (10 , unit = "m" ),
388
+ pd .Timedelta (10 , unit = "h" )],
389
+ "datetime" : [pd .to_datetime ("2017-08-01 00:00:00" ),
390
+ pd .to_datetime ("2017-08-01 02:00:00" ),
391
+ pd .to_datetime ("2017-08-02 00:00:00" )],
392
+ "text" : ["This" , "should" , "fail" ]})
393
+ ax_numeric = testdata .plot (y = "numeric" )
394
+ assert (ax_numeric .get_lines ()[0 ].get_data ()[1 ] == testdata ["numeric" ].values ).all ()
395
+ ax_timedelta = testdata .plot (y = "timedelta" )
396
+ assert (ax_timedelta .get_lines ()[0 ].get_data ()[1 ] == testdata ["timedelta" ].values ).all ()
397
+ ax_datetime = testdata .plot (y = "datetime" )
398
+ assert (ax_datetime .get_lines ()[0 ].get_data ()[1 ] == testdata ["datetime" ].values ).all ()
399
+ with pytest .raises (TypeError ):
400
+ testdata .plot (y = "text" )
401
+
383
402
@pytest .mark .slow
384
403
def test_subplots_layout (self ):
385
404
# GH 6667
0 commit comments