@@ -260,9 +260,15 @@ def __init__(self, parent, userax=True):
260
260
self .outer_ax .tick_params = self .inner_ax .tick_params
261
261
self .outer_ax .set_xticks = self .inner_ax .set_xticks
262
262
self .outer_ax .set_yticks = self .inner_ax .set_yticks
263
- for attr in ["get_position" , "set_position" , "set_aspect" ]:
263
+ for attr in ["get_position" , "set_aspect" ,
264
+ "_remove_method" , "_set_position" ,
265
+ "set_position" ]:
264
266
setattr (self , attr , getattr (self .outer_ax , attr ))
265
267
self ._colorbar_info = None # used for mpl-created axes
268
+ if hasattr (self .outer_ax , "get_subplotspec" ):
269
+ attr = "get_subplotspec"
270
+ setattr (self , attr , getattr (self .outer_ax , attr ))
271
+
266
272
if userax :
267
273
self ._colorbar_info = 'user'
268
274
# point the parent's methods all at this axes...
@@ -279,6 +285,7 @@ def draw(self, renderer):
279
285
self .outer_ax .draw (renderer )
280
286
281
287
288
+
282
289
class _ColorbarSpine (mspines .Spine ):
283
290
def __init__ (self , axes ):
284
291
self ._ax = axes
@@ -954,12 +961,11 @@ def set_alpha(self, alpha):
954
961
def remove (self ):
955
962
"""
956
963
Remove this colorbar from the figure.
957
-
964
+
958
965
If the colorbar was created with ``use_gridspec=True`` the previous
959
966
gridspec is restored.
960
967
"""
961
- self .ax .inner_ax .remove ()
962
- self .ax .outer_ax .remove ()
968
+ self .ax .remove ()
963
969
964
970
self .mappable .callbacksSM .disconnect (self .mappable .colorbar_cid )
965
971
self .mappable .colorbar = None
0 commit comments