Skip to content

Commit b69b2ee

Browse files
committed
MNT/FIX: add explicit stale=True in add_* methods
In the Axes.add_* methods explicitly set the axes as stale, because there is a new child in the draw tree. This was implicitly happening for add_line (and may have been for others)
1 parent 48c028c commit b69b2ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,7 @@ def add_artist(self, a):
16501650
self._set_artist_props(a)
16511651
a.set_clip_path(self.patch)
16521652
a._remove_method = lambda h: self.artists.remove(h)
1653+
self.stale = True
16531654
return a
16541655

16551656
def add_collection(self, collection, autolim=True):
@@ -1672,6 +1673,7 @@ def add_collection(self, collection, autolim=True):
16721673
self.update_datalim(collection.get_datalim(self.transData))
16731674

16741675
collection._remove_method = lambda h: self.collections.remove(h)
1676+
self.stale = True
16751677
return collection
16761678

16771679
def add_image(self, image):
@@ -1683,6 +1685,7 @@ def add_image(self, image):
16831685
self._set_artist_props(image)
16841686
self.images.append(image)
16851687
image._remove_method = lambda h: self.images.remove(h)
1688+
self.stale = True
16861689
return image
16871690

16881691
def add_line(self, line):
@@ -1701,6 +1704,7 @@ def add_line(self, line):
17011704
line.set_label('_line%d' % len(self.lines))
17021705
self.lines.append(line)
17031706
line._remove_method = lambda h: self.lines.remove(h)
1707+
self.stale = True
17041708
return line
17051709

17061710
def _add_text(self, txt):

0 commit comments

Comments
 (0)