@@ -374,7 +374,6 @@ def test_axis_limits(self):
374
374
def _test (ax ):
375
375
xlim = ax .get_xlim ()
376
376
ax .set_xlim (xlim [0 ] - 5 , xlim [1 ] + 10 )
377
- ax .get_figure ().canvas .draw ()
378
377
result = ax .get_xlim ()
379
378
assert result [0 ] == xlim [0 ] - 5
380
379
assert result [1 ] == xlim [1 ] + 10
@@ -383,7 +382,6 @@ def _test(ax):
383
382
expected = (Period ('1/1/2000' , ax .freq ),
384
383
Period ('4/1/2000' , ax .freq ))
385
384
ax .set_xlim ('1/1/2000' , '4/1/2000' )
386
- ax .get_figure ().canvas .draw ()
387
385
result = ax .get_xlim ()
388
386
assert int (result [0 ]) == expected [0 ].ordinal
389
387
assert int (result [1 ]) == expected [1 ].ordinal
@@ -392,7 +390,6 @@ def _test(ax):
392
390
expected = (Period ('1/1/2000' , ax .freq ),
393
391
Period ('4/1/2000' , ax .freq ))
394
392
ax .set_xlim (datetime (2000 , 1 , 1 ), datetime (2000 , 4 , 1 ))
395
- ax .get_figure ().canvas .draw ()
396
393
result = ax .get_xlim ()
397
394
assert int (result [0 ]) == expected [0 ].ordinal
398
395
assert int (result [1 ]) == expected [1 ].ordinal
@@ -429,12 +426,7 @@ def test_get_finder(self):
429
426
def test_finder_daily (self ):
430
427
day_lst = [10 , 40 , 252 , 400 , 950 , 2750 , 10000 ]
431
428
432
- if self .mpl_ge_3_0_0 or not self .mpl_ge_2_2_3 :
433
- xpl1 = xpl2 = [Period ('1999-1-1' , freq = 'B' ).ordinal ] * len (day_lst )
434
- else : # 2.2.3, 2.2.4
435
- xpl1 = [7565 , 7564 , 7553 , 7546 , 7518 , 7428 , 7066 ]
436
- xpl2 = [7566 , 7564 , 7554 , 7546 , 7519 , 7429 , 7066 ]
437
-
429
+ xpl1 = xpl2 = [Period ('1999-1-1' , freq = 'B' ).ordinal ] * len (day_lst )
438
430
rs1 = []
439
431
rs2 = []
440
432
for i , n in enumerate (day_lst ):
@@ -457,12 +449,7 @@ def test_finder_daily(self):
457
449
def test_finder_quarterly (self ):
458
450
yrs = [3.5 , 11 ]
459
451
460
- if self .mpl_ge_3_0_0 or not self .mpl_ge_2_2_3 :
461
- xpl1 = xpl2 = [Period ('1988Q1' ).ordinal ] * len (yrs )
462
- else : # 2.2.3, 2.2.4
463
- xpl1 = [68 , 68 ]
464
- xpl2 = [72 , 68 ]
465
-
452
+ xpl1 = xpl2 = [Period ('1988Q1' ).ordinal ] * len (yrs )
466
453
rs1 = []
467
454
rs2 = []
468
455
for i , n in enumerate (yrs ):
@@ -485,12 +472,7 @@ def test_finder_quarterly(self):
485
472
def test_finder_monthly (self ):
486
473
yrs = [1.15 , 2.5 , 4 , 11 ]
487
474
488
- if self .mpl_ge_3_0_0 or not self .mpl_ge_2_2_3 :
489
- xpl1 = xpl2 = [Period ('Jan 1988' ).ordinal ] * len (yrs )
490
- else : # 2.2.3, 2.2.4
491
- xpl1 = [216 , 216 , 204 , 204 ]
492
- xpl2 = [216 , 216 , 216 , 204 ]
493
-
475
+ xpl1 = xpl2 = [Period ('Jan 1988' ).ordinal ] * len (yrs )
494
476
rs1 = []
495
477
rs2 = []
496
478
for i , n in enumerate (yrs ):
@@ -521,11 +503,7 @@ def test_finder_monthly_long(self):
521
503
522
504
@pytest .mark .slow
523
505
def test_finder_annual (self ):
524
- if self .mpl_ge_3_0_0 or not self .mpl_ge_2_2_3 :
525
- xp = [1987 , 1988 , 1990 , 1990 , 1995 , 2020 , 2070 , 2170 ]
526
- else : # 2.2.3, 2.2.4
527
- xp = [1986 , 1986 , 1990 , 1990 , 1995 , 2020 , 1970 , 1970 ]
528
-
506
+ xp = [1987 , 1988 , 1990 , 1990 , 1995 , 2020 , 2070 , 2170 ]
529
507
xp = [Period (x , freq = 'A' ).ordinal for x in xp ]
530
508
rs = []
531
509
for i , nyears in enumerate ([5 , 10 , 19 , 49 , 99 , 199 , 599 , 1001 ]):
@@ -1093,7 +1071,6 @@ def test_time(self):
1093
1071
df .plot (ax = ax )
1094
1072
1095
1073
# verify tick labels
1096
- fig .canvas .draw ()
1097
1074
ticks = ax .get_xticks ()
1098
1075
labels = ax .get_xticklabels ()
1099
1076
for t , l in zip (ticks , labels ):
@@ -1120,7 +1097,6 @@ def test_time_change_xlim(self):
1120
1097
df .plot (ax = ax )
1121
1098
1122
1099
# verify tick labels
1123
- fig .canvas .draw ()
1124
1100
ticks = ax .get_xticks ()
1125
1101
labels = ax .get_xticklabels ()
1126
1102
for t , l in zip (ticks , labels ):
@@ -1138,7 +1114,6 @@ def test_time_change_xlim(self):
1138
1114
ax .set_xlim ('1:30' , '5:00' )
1139
1115
1140
1116
# check tick labels again
1141
- fig .canvas .draw ()
1142
1117
ticks = ax .get_xticks ()
1143
1118
labels = ax .get_xticklabels ()
1144
1119
for t , l in zip (ticks , labels ):
@@ -1165,7 +1140,6 @@ def test_time_musec(self):
1165
1140
ax = df .plot (ax = ax )
1166
1141
1167
1142
# verify tick labels
1168
- fig .canvas .draw ()
1169
1143
ticks = ax .get_xticks ()
1170
1144
labels = ax .get_xticklabels ()
1171
1145
for t , l in zip (ticks , labels ):
@@ -1432,7 +1406,7 @@ def test_format_timedelta_ticks_narrow(self):
1432
1406
df = DataFrame (np .random .randn (len (rng ), 3 ), rng )
1433
1407
fig , ax = self .plt .subplots ()
1434
1408
df .plot (fontsize = 2 , ax = ax )
1435
- fig . canvas .draw ()
1409
+ self . plt .draw ()
1436
1410
labels = ax .get_xticklabels ()
1437
1411
1438
1412
result_labels = [x .get_text () for x in labels ]
@@ -1456,7 +1430,7 @@ def test_format_timedelta_ticks_wide(self):
1456
1430
df = DataFrame (np .random .randn (len (rng ), 3 ), rng )
1457
1431
fig , ax = self .plt .subplots ()
1458
1432
ax = df .plot (fontsize = 2 , ax = ax )
1459
- fig . canvas .draw ()
1433
+ self . plt .draw ()
1460
1434
labels = ax .get_xticklabels ()
1461
1435
1462
1436
result_labels = [x .get_text () for x in labels ]
@@ -1529,7 +1503,7 @@ def test_matplotlib_scatter_datetime64(self):
1529
1503
df ["time" ] = date_range ("2018-01-01" , periods = 10 , freq = "D" )
1530
1504
fig , ax = self .plt .subplots ()
1531
1505
ax .scatter (x = "time" , y = "y" , data = df )
1532
- fig . canvas .draw ()
1506
+ self . plt .draw ()
1533
1507
label = ax .get_xticklabels ()[0 ]
1534
1508
if self .mpl_ge_3_0_0 :
1535
1509
expected = "2017-12-08"
0 commit comments