@@ -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
@@ -709,26 +719,8 @@ def _config_axes(self, X, Y):
709
719
ax .update_datalim (xy )
710
720
ax .set_xlim (* ax .dataLim .intervalx )
711
721
ax .set_ylim (* ax .dataLim .intervaly )
712
- if self .outline is not None :
713
- self .outline .remove ()
714
- self .outline = mpatches .Polygon (
715
- xy , edgecolor = mpl .rcParams ['axes.edgecolor' ],
716
- facecolor = 'none' ,
717
- linewidth = mpl .rcParams ['axes.linewidth' ],
718
- closed = True ,
719
- zorder = 2 )
720
- ax .add_artist (self .outline )
721
- self .outline .set_clip_box (None )
722
- self .outline .set_clip_path (None )
723
- c = mpl .rcParams ['axes.facecolor' ]
724
- if self .patch is not None :
725
- self .patch .remove ()
726
- self .patch = mpatches .Polygon (xy , edgecolor = c ,
727
- facecolor = c ,
728
- linewidth = 0.01 ,
729
- zorder = - 1 )
730
- ax .add_artist (self .patch )
731
-
722
+ self .outline .set_xy (xy )
723
+ self .patch .set_xy (xy )
732
724
self .update_ticks ()
733
725
734
726
def _set_label (self ):
@@ -1276,10 +1268,18 @@ def update_bruteforce(self, mappable):
1276
1268
self .formatter = None
1277
1269
1278
1270
# clearing the axes will delete outline, patch, solids, and lines:
1279
- self .outline = None
1280
- self .patch = None
1271
+ self .outline = mpatches .Polygon (
1272
+ np .empty ((0 , 2 )),
1273
+ edgecolor = mpl .rcParams ['axes.edgecolor' ], facecolor = 'none' ,
1274
+ linewidth = mpl .rcParams ['axes.linewidth' ], closed = True , zorder = 2 )
1275
+ self .ax .add_artist (self .outline )
1276
+ self .outline .set (clip_box = None , clip_path = None )
1277
+ self .patch = mpatches .Polygon (
1278
+ np .empty ((0 , 2 )),
1279
+ color = mpl .rcParams ['axes.facecolor' ], linewidth = 0.01 , zorder = - 1 )
1280
+ self .ax .add_artist (self .patch )
1281
1281
self .solids = None
1282
- self .lines = list ()
1282
+ self .lines = []
1283
1283
self .dividers = None
1284
1284
self .update_normal (mappable )
1285
1285
self .draw_all ()
0 commit comments