@@ -444,9 +444,19 @@ def __init__(self, ax, cmap=None,
444
444
self .extendfrac = extendfrac
445
445
self .extendrect = extendrect
446
446
self .solids = None
447
- self .lines = list ()
448
- self .outline = None
449
- self .patch = None
447
+ self .lines = []
448
+
449
+ self .outline = mpatches .Polygon (
450
+ np .empty ((0 , 2 )),
451
+ edgecolor = mpl .rcParams ['axes.edgecolor' ], facecolor = 'none' ,
452
+ linewidth = mpl .rcParams ['axes.linewidth' ], closed = True , zorder = 2 )
453
+ ax .add_artist (self .outline )
454
+ self .outline .set (clip_box = None , clip_path = None )
455
+ self .patch = mpatches .Polygon (
456
+ np .empty ((0 , 2 )),
457
+ color = mpl .rcParams ['axes.facecolor' ], linewidth = 0.01 , zorder = - 1 )
458
+ ax .add_artist (self .patch )
459
+
450
460
self .dividers = None
451
461
self .locator = None
452
462
self .formatter = None
@@ -719,26 +729,8 @@ def _config_axes(self, X, Y):
719
729
ax .update_datalim (xy )
720
730
ax .set_xlim (* ax .dataLim .intervalx )
721
731
ax .set_ylim (* ax .dataLim .intervaly )
722
- if self .outline is not None :
723
- self .outline .remove ()
724
- self .outline = mpatches .Polygon (
725
- xy , edgecolor = mpl .rcParams ['axes.edgecolor' ],
726
- facecolor = 'none' ,
727
- linewidth = mpl .rcParams ['axes.linewidth' ],
728
- closed = True ,
729
- zorder = 2 )
730
- ax .add_artist (self .outline )
731
- self .outline .set_clip_box (None )
732
- self .outline .set_clip_path (None )
733
- c = mpl .rcParams ['axes.facecolor' ]
734
- if self .patch is not None :
735
- self .patch .remove ()
736
- self .patch = mpatches .Polygon (xy , edgecolor = c ,
737
- facecolor = c ,
738
- linewidth = 0.01 ,
739
- zorder = - 1 )
740
- ax .add_artist (self .patch )
741
-
732
+ self .outline .set_xy (xy )
733
+ self .patch .set_xy (xy )
742
734
self .update_ticks ()
743
735
744
736
def _set_label (self ):
@@ -1322,10 +1314,18 @@ def update_bruteforce(self, mappable):
1322
1314
self .formatter = None
1323
1315
1324
1316
# clearing the axes will delete outline, patch, solids, and lines:
1325
- self .outline = None
1326
- self .patch = None
1317
+ self .outline = mpatches .Polygon (
1318
+ np .empty ((0 , 2 )),
1319
+ edgecolor = mpl .rcParams ['axes.edgecolor' ], facecolor = 'none' ,
1320
+ linewidth = mpl .rcParams ['axes.linewidth' ], closed = True , zorder = 2 )
1321
+ self .ax .add_artist (self .outline )
1322
+ self .outline .set (clip_box = None , clip_path = None )
1323
+ self .patch = mpatches .Polygon (
1324
+ np .empty ((0 , 2 )),
1325
+ color = mpl .rcParams ['axes.facecolor' ], linewidth = 0.01 , zorder = - 1 )
1326
+ self .ax .add_artist (self .patch )
1327
1327
self .solids = None
1328
- self .lines = list ()
1328
+ self .lines = []
1329
1329
self .dividers = None
1330
1330
self .update_normal (mappable )
1331
1331
self .draw_all ()
0 commit comments