Skip to content

Commit 46af65a

Browse files
committed
MNT : only set the figure call back if figure is not None
1 parent 17c4461 commit 46af65a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/artist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,9 @@ def set_figure(self, fig):
605605
ACCEPTS: a :class:`matplotlib.figure.Figure` instance
606606
"""
607607
self.figure = fig
608-
self.add_callback(_dirty_figure_callback)
609-
self.pchanged()
608+
if self.figure and self.figure is not self:
609+
self.add_callback(_dirty_figure_callback)
610+
self.pchanged()
610611

611612
def set_clip_box(self, clipbox):
612613
"""

0 commit comments

Comments
 (0)