@@ -1273,7 +1273,6 @@ def test_plot_outofbounds_datetime(self):
1273
1273
self .plt .plot (values )
1274
1274
1275
1275
def test_format_timedelta_ticks_narrow (self ):
1276
- import matplotlib .pyplot as plt
1277
1276
1278
1277
expected_labels = [
1279
1278
'00:00:00.00000000{:d}' .format (i )
@@ -1282,16 +1281,16 @@ def test_format_timedelta_ticks_narrow(self):
1282
1281
rng = timedelta_range ('0' , periods = 10 , freq = 'ns' )
1283
1282
df = DataFrame (np .random .randn (len (rng ), 3 ), rng )
1284
1283
ax = df .plot (fontsize = 2 )
1285
- plt .gcf ().autofmt_xdate ()
1286
- ax .get_figure ().canvas .draw_idle ()
1284
+ fig = ax .get_figure ()
1285
+ fig .autofmt_xdate ()
1286
+ fig .canvas .draw ()
1287
1287
labels = ax .get_xticklabels ()
1288
1288
self .assertEqual (len (labels ), len (expected_labels ))
1289
1289
for l , l_expected in zip (labels , expected_labels ):
1290
1290
self .assertEqual (l .get_text (), l_expected )
1291
1291
self .assertEqual (l .get_rotation (), 30 )
1292
1292
1293
1293
def test_format_timedelta_ticks_wide (self ):
1294
- import matplotlib .pyplot as plt
1295
1294
1296
1295
expected_labels = [
1297
1296
'00:00:00' ,
@@ -1308,8 +1307,9 @@ def test_format_timedelta_ticks_wide(self):
1308
1307
rng = timedelta_range ('0' , periods = 10 , freq = '1 d' )
1309
1308
df = DataFrame (np .random .randn (len (rng ), 3 ), rng )
1310
1309
ax = df .plot (fontsize = 2 )
1311
- plt .gcf ().autofmt_xdate ()
1312
- ax .get_figure ().canvas .draw_idle ()
1310
+ fig = ax .get_figure ()
1311
+ fig .autofmt_xdate ()
1312
+ fig .canvas .draw ()
1313
1313
labels = ax .get_xticklabels ()
1314
1314
self .assertEqual (len (labels ), len (expected_labels ))
1315
1315
for l , l_expected in zip (labels , expected_labels ):
0 commit comments