@@ -114,7 +114,7 @@ def _stale_changed(self, name, new):
114
114
transform_set = Bool (False )
115
115
116
116
def _axes_changed (self , name , old , new ):
117
- if old not in (Undefined ,None ):
117
+ if new and old not in (Undefined ,None ):
118
118
raise ValueError ("Can not reset the axes. You are "
119
119
"probably trying to re-use an artist "
120
120
"in more than one Axes which is not "
@@ -124,7 +124,7 @@ def _axes_changed(self, name, old, new):
124
124
125
125
axes = Instance (str ('matplotlib.axes.Axes' ), allow_none = True )
126
126
127
- figure = Instance (str ('matplotlib.figure.Figure ' ), allow_none = True )
127
+ figure = Instance (str ('matplotlib.figure.FigureBase ' ), allow_none = True )
128
128
129
129
def _figure_changed (self , name , old , new ):
130
130
if old not in (None , Undefined ):
@@ -259,9 +259,13 @@ def remove(self):
259
259
_ax_flag = True
260
260
261
261
if self .figure :
262
- self .figure = None
262
+ self .private ( ' figure' , None )
263
263
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 ())
265
269
266
270
else :
267
271
raise NotImplementedError ('cannot remove artist' )
0 commit comments