@@ -331,7 +331,7 @@ def test_freq_with_no_period_alias(self):
331
331
bts = tm .makeTimeSeries (5 ).asfreq (freq )
332
332
_ , ax = self .plt .subplots ()
333
333
bts .plot (ax = ax )
334
- assert ax . get_lines ()[ 0 ]. get_xydata ()[ 0 , 0 ] == bts . index [ 0 ]. toordinal ()
334
+
335
335
idx = ax .get_lines ()[0 ].get_xdata ()
336
336
msg = "freq not specified and cannot be inferred"
337
337
with pytest .raises (ValueError , match = msg ):
@@ -1279,6 +1279,8 @@ def test_mpl_nopandas(self):
1279
1279
@pytest .mark .slow
1280
1280
def test_irregular_ts_shared_ax_xlim (self ):
1281
1281
# GH 2960
1282
+ from pandas .plotting ._matplotlib .converter import DatetimeConverter
1283
+
1282
1284
ts = tm .makeTimeSeries ()[:20 ]
1283
1285
ts_irregular = ts [[1 , 4 , 5 , 6 , 8 , 9 , 10 , 12 , 13 , 14 , 15 , 17 , 18 ]]
1284
1286
@@ -1289,8 +1291,8 @@ def test_irregular_ts_shared_ax_xlim(self):
1289
1291
1290
1292
# check that axis limits are correct
1291
1293
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 )
1294
1296
1295
1297
@pytest .mark .slow
1296
1298
def test_secondary_y_non_ts_xlim (self ):
@@ -1345,6 +1347,8 @@ def test_secondary_y_mixed_freq_ts_xlim(self):
1345
1347
@pytest .mark .slow
1346
1348
def test_secondary_y_irregular_ts_xlim (self ):
1347
1349
# GH 3490 - irregular-timeseries with secondary y
1350
+ from pandas .plotting ._matplotlib .converter import DatetimeConverter
1351
+
1348
1352
ts = tm .makeTimeSeries ()[:20 ]
1349
1353
ts_irregular = ts [[1 , 4 , 5 , 6 , 8 , 9 , 10 , 12 , 13 , 14 , 15 , 17 , 18 ]]
1350
1354
@@ -1356,8 +1360,8 @@ def test_secondary_y_irregular_ts_xlim(self):
1356
1360
ts_irregular [:5 ].plot (ax = ax )
1357
1361
1358
1362
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 )
1361
1365
1362
1366
def test_plot_outofbounds_datetime (self ):
1363
1367
# 2579 - checking this does not raise
0 commit comments