@@ -444,9 +444,19 @@ def __init__(self, ax, cmap=None,
444444 self .extendfrac = extendfrac
445445 self .extendrect = extendrect
446446 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+
450460 self .dividers = None
451461 self .locator = None
452462 self .formatter = None
@@ -719,26 +729,8 @@ def _config_axes(self, X, Y):
719729 ax .update_datalim (xy )
720730 ax .set_xlim (* ax .dataLim .intervalx )
721731 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 )
742734 self .update_ticks ()
743735
744736 def _set_label (self ):
@@ -1322,10 +1314,18 @@ def update_bruteforce(self, mappable):
13221314 self .formatter = None
13231315
13241316 # 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 )
13271327 self .solids = None
1328- self .lines = list ()
1328+ self .lines = []
13291329 self .dividers = None
13301330 self .update_normal (mappable )
13311331 self .draw_all ()
0 commit comments