8000 update rebase · rmorshea/matplotlib@8cd7878 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8cd7878

Browse files
committed
update rebase
1 parent 1b131c1 commit 8cd7878

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

lib/matplotlib/artist.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _stale_changed(self, name, new):
114114
transform_set = Bool(False)
115115

116116
def _axes_changed(self, name, old, new):
117-
if old not in (Undefined,None):
117+
if new and old not in (Undefined,None):
118118
raise ValueError("Can not reset the axes. You are "
119119
"probably trying to re-use an artist "
120120
"in more than one Axes which is not "
@@ -124,7 +124,7 @@ def _axes_changed(self, name, old, new):
124124

125125
axes = Instance(str('matplotlib.axes.Axes'), allow_none=True)
126126

127-
figure = Instance(str('matplotlib.figure.Figure'), allow_none=True)
127+
figure = Instance(str('matplotlib.figure.FigureBase'), allow_none=True)
128128

129129
def _figure_changed(self, name, old, new):
130130
if old not in (None, Undefined):
@@ -259,9 +259,13 @@ def remove(self):
259259
_ax_flag = True
260260

261261
if self.figure:
262-
self.figure = None
262+
self.private('figure', None)
263263
if not _ax_flag:
264-
self.figure = True
264+
from matplotlib.figure import FigureBase
265+
# was originally self.private(figure, True)
266+
# which won't pass validation. For the moment,
267+
# use an empty base class to pass validation.
268+
self.private('figure', FigureBase())
265269

266270
else:
267271
raise NotImplementedError('cannot remove artist')

lib/matplotlib/figure.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,12 @@ def _update_this(self, s, val):
238238

239239
setattr(self, s, val)
240240

241+
# used solely for passing an empty figure class to
242+
# the "figure" attribute of an artist which will pass
243+
# a boolean test (e.g `True if figure else False`)
244+
class FigureBase(object): pass
241245

242-
class Figure(Artist):
246+
class Figure(FigureBase, Artist):
243247

244248
"""
245249
The Figure instance supports callbacks through a *callbacks*

0 commit comments

Comments
 (0)
0