@@ -331,7 +331,7 @@ def test_freq_with_no_period_alias(self):
331331 bts = tm .makeTimeSeries (5 ).asfreq (freq )
332332 _ , ax = self .plt .subplots ()
333333 bts .plot (ax = ax )
334- assert ax . get_lines ()[ 0 ]. get_xydata ()[ 0 , 0 ] == bts . index [ 0 ]. toordinal ()
334+
335335 idx = ax .get_lines ()[0 ].get_xdata ()
336336 msg = "freq not specified and cannot be inferred"
337337 with pytest .raises (ValueError , match = msg ):
@@ -1279,6 +1279,8 @@ def test_mpl_nopandas(self):
12791279 @pytest .mark .slow
12801280 def test_irregular_ts_shared_ax_xlim (self ):
12811281 # GH 2960
1282+ from pandas .plotting ._matplotlib .converter import DatetimeConverter
1283+
12821284 ts = tm .makeTimeSeries ()[:20 ]
12831285 ts_irregular = ts [[1 , 4 , 5 , 6 , 8 , 9 , 10 , 12 , 13 , 14 , 15 , 17 , 18 ]]
12841286
@@ -1289,8 +1291,8 @@ def test_irregular_ts_shared_ax_xlim(self):
12891291
12901292 # check that axis limits are correct
12911293 left , right = ax .get_xlim ()
1292- assert left <= ts_irregular .index .min (). toordinal ( )
1293- assert right >= ts_irregular .index .max (). toordinal ( )
1294+ assert left <= DatetimeConverter . convert ( ts_irregular .index .min (), "" , ax )
1295+ assert right >= DatetimeConverter . convert ( ts_irregular .index .max (), "" , ax )
12941296
12951297 @pytest .mark .slow
12961298 def test_secondary_y_non_ts_xlim (self ):
@@ -1345,6 +1347,8 @@ def test_secondary_y_mixed_freq_ts_xlim(self):
13451347 @pytest .mark .slow
13461348 def test_secondary_y_irregular_ts_xlim (self ):
13471349 # GH 3490 - irregular-timeseries with secondary y
1350+ from pandas .plotting ._matplotlib .converter import DatetimeConverter
1351+
13481352 ts = tm .makeTimeSeries ()[:20 ]
13491353 ts_irregular = ts [[1 , 4 , 5 , 6 , 8 , 9 , 10 , 12 , 13 , 14 , 15 , 17 , 18 ]]
13501354
@@ -1356,8 +1360,8 @@ def test_secondary_y_irregular_ts_xlim(self):
13561360 ts_irregular [:5 ].plot (ax = ax )
13571361
13581362 left , right = ax .get_xlim ()
1359- assert left <= ts_irregular .index .min (). toordinal ( )
1360- assert right >= ts_irregular .index .max (). toordinal ( )
1363+ assert left <= DatetimeConverter . convert ( ts_irregular .index .min (), "" , ax )
1364+ assert right >= DatetimeConverter . convert ( ts_irregular .index .max (), "" , ax )
13611365
13621366 def test_plot_outofbounds_datetime (self ):
13631367 # 2579 - checking this does not raise
0 commit comments