Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 955a290

Browse files
James Evanstacaswell
James Evans
authored andcommitted
FIX: stale propagation in artist with out fig/ax
Artists do not properly guard against being removed from figures or Axes when tracking 'stale'. This will keep them from throwing an exception if they become stale after being removed from an Axes or Figure.
1 parent a48be9f commit 955a290

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/matplotlib/artist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def draw_wrapper(artist, renderer, *args, **kwargs):
6767
draw_wrapper._supports_rasterization = True
6868
return draw_wrapper
6969

70-
71-
def _stale_axes_callback(self, value):
72-
self.axes.stale = True
70+
def _stale_axes_callback(self):
71+
if self.axes:
72+
self.axes.stale = True
7373

7474

7575
class Artist(object):

lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252

5353

5454
def _stale_figure_callback(self, val):
55-
self.figure.stale = val
55+
if self.figure:
56+
self.figure.stale = val
5657

5758

5859
class AxesStack(Stack):

0 commit comments

Comments
 (0)