diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index ead63f4f3af6..2d227c6b12f9 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1503,6 +1503,25 @@ def test(verbosity=1): return success + +def deprecated_get_set(fclass, function, to_use): + """Fuction to deprecate the getters and setter for a class + argument. + + Parameter + --------- + - fclass: class + The class of the function to deprecate + - function: function + The function to deprecate. + - to_use: string + The argument to use instead of the deprecated function + """ + msg = "{}.{} is deprecated, please use the `{}` argument" + msg = msg.format(fclass.__name__, function.__name__, to_use) + warnings.warn(msg, mplDeprecation, stacklevel=1) + + test.__test__ = False # nose: this function is not a test verbose.report('matplotlib version %s' % __version__) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index e6d428fba997..f4b69bd4ba37 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -9,7 +9,7 @@ import matplotlib import matplotlib.cbook as cbook from matplotlib.cbook import mplDeprecation -from matplotlib import docstring, rcParams +from matplotlib import docstring, rcParams, deprecated_get_set from .transforms import (Bbox, IdentityTransform, TransformedBbox, TransformedPath, Transform) from .path import Path @@ -88,7 +88,7 @@ class Artist(object): def __init__(self): self._stale = True self._axes = None - self.figure = None + self._figure = None self._transform = None self._transformSet = False @@ -594,11 +594,26 @@ def set_path_effects(self, path_effects): def get_path_effects(self): return self._path_effects + @property + def figure(self): + """:class:`~matplotlib.figure.Figure` instance the artist + belongs to""" + return self._figure + + @figure.setter + def figure(self, fig): + self._figure = fig + if self._figure and self._figure is not self: + self.add_callback(_stale_figure_callback) + self.pchanged() + self.stale = True + def get_figure(self): """ Return the :class:`~matplotlib.figure.Figure` instance the artist belongs to. """ + deprecated_get_set(self.__class__, self.get_figure, "figure") return self.figure def set_figure(self, fig): @@ -608,11 +623,8 @@ def set_figure(self, fig): ACCEPTS: a :class:`matplotlib.figure.Figure` instance """ + deprecated_get_set(self.__class__, self.set_figure, "figure") self.figure = fig - if self.figure and self.figure is not self: - self.add_callback(_stale_figure_callback) - self.pchanged() - self.stale = True def set_clip_box(self, clipbox): """ diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 0b3f8b20a738..7dd447d927c4 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -421,7 +421,7 @@ def __init__(self, fig, rect, # 'shared axes: "adjustable" is being changed to "datalim"') self._adjustable = 'datalim' self.set_label(label) - self.set_figure(fig) + self.figure = fig self.set_axes_locator(kwargs.get("axes_locator", None)) @@ -500,8 +500,12 @@ def set_figure(self, fig): accepts a class:`~matplotlib.figure.Figure` instance """ - martist.Artist.set_figure(self, fig) + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + @martist.Artist.figure.setter + def figure(self, fig): + martist.Artist.figure.__set__(self, fig) self.bbox = mtransforms.TransformedBbox(self._position, fig.transFigure) # these will be updated later as data is added @@ -781,7 +785,7 @@ def get_axes_locator(self): def _set_artist_props(self, a): """set the boilerplate props for artists added to axes""" - a.set_figure(self.figure) + a.figure = self.figure if not a.is_transform_set(): a.set_transform(self.transData) @@ -959,7 +963,7 @@ def cla(self): # deprecated. We use the frame to draw the edges so we are # setting the edgecolor to None self.patch = self.axesPatch = self._gen_axes_patch() - self.patch.set_figure(self.figure) + self.patch.figure = self.figure self.patch.set_facecolor(self._axisbg) self.patch.set_edgecolor('None') self.patch.set_linewidth(0) @@ -1211,7 +1215,7 @@ def apply_aspect(self, position=None): warnings.warn( 'shared axes: "adjustable" is being changed to "datalim"') - figW, figH = self.get_figure().get_size_inches() + figW, figH = self.figure.get_size_inches() fig_aspect = figH / figW if self._adjustable in ['box', 'box-forced']: if aspect_scale_mode == "log": diff --git a/lib/matplotlib/axes/_subplots.py b/lib/matplotlib/axes/_subplots.py index 118a557b5bf6..a72b4c9b403f 100644 --- a/lib/matplotlib/axes/_subplots.py +++ b/lib/matplotlib/axes/_subplots.py @@ -35,7 +35,7 @@ def __init__(self, fig, *args, **kwargs): decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ - self.figure = fig + self._figure = fig if len(args) == 1: if isinstance(args[0], SubplotSpec): diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 0710eddf1154..38adb1a3346b 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -97,7 +97,7 @@ def __init__(self, axes, loc, label, else: gridOn = False - self.set_figure(axes.figure) + self.figure = axes.figure self.axes = axes name = self.__name__.lower() @@ -277,7 +277,7 @@ def set_label2(self, s): self.stale = True def _set_artist_props(self, a): - a.set_figure(self.figure) + a.figure = self.figure def get_view_interval(self): 'return the view Interval instance for the axis this tick is ticking' @@ -625,7 +625,7 @@ def __init__(self, axes, pickradius=15): Init the axis with the parent Axes instance """ artist.Artist.__init__(self) - self.set_figure(axes.figure) + self.figure = axes.figure # Keep track of setting to the default value, this allows use to know # if any of the following values is explicitly set by the user, so as @@ -883,7 +883,7 @@ def set_default_intervals(self): def _set_artist_props(self, a): if a is None: return - a.set_figure(self.figure) + a.figure = self.figure def iter_ticks(self): """ diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index bf1ec010c176..5ac17cab3517 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -154,7 +154,7 @@ def apply_callback(data): new_legend.draggable(draggable) # Redraw - figure = axes.get_figure() + figure = axes.figure figure.canvas.draw() data = formlayout.fedit(datalist, title="Figure options", parent=parent, diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 82d5a04f7341..723bf0fcbb13 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1095,8 +1095,8 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, if not isinstance(parents, (list, tuple)): parents = [parents] - fig = parents[0].get_figure() - if not all(fig is ax.get_figure() for ax in parents): + fig = parents[0].figure + if not all(fig is ax.figure for ax in parents): raise ValueError('Unable to create a colorbar axes as not all ' 'parents share the same figure.') @@ -1232,7 +1232,7 @@ def make_axes_gridspec(parent, **kw): parent.set_position(parent.figbox) parent.set_anchor(panchor) - fig = parent.get_figure() + fig = parent.figure cax = fig.add_subplot(gs2[1]) cax.set_aspect(aspect, anchor=anchor, adjustable='box') return cax, kw diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 073d6889f74a..05f2ef33d6e7 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -888,7 +888,7 @@ def add_axes(self, *args, **kwargs): if isinstance(args[0], Axes): a = args[0] - if a.get_figure() is not self: + if a.figure is not self: msg = "The Axes must have been created in the present figure" raise ValueError(msg) else: @@ -965,7 +965,7 @@ def add_subplot(self, *args, **kwargs): if isinstance(args[0], SubplotBase): a = args[0] - if a.get_figure() is not self: + if a.figure is not self: msg = ("The Subplot must have been created in the present" " figure") raise ValueError(msg) @@ -1271,7 +1271,7 @@ def text(self, x, y, s, *args, **kwargs): def _set_artist_props(self, a): if a != self: - a.set_figure(self) + a.figure = self a.set_transform(self.transFigure) @docstring.dedent_interpd diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 01e36e831785..210505ecea13 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1127,7 +1127,7 @@ def __init__(self, bbox, def get_window_extent(self, renderer=None): if renderer is None: - renderer = self.get_figure()._cachedRenderer + renderer = self.figure._cachedRenderer if isinstance(self.bbox, BboxBase): return self.bbox @@ -1141,7 +1141,7 @@ def contains(self, mouseevent): if six.callable(self._contains): return self._contains(self, mouseevent) - if not self.get_visible(): # or self.get_figure()._renderer is None: + if not self.get_visible(): # or self.figure._renderer is None: return False, {} x, y = mouseevent.x, mouseevent.y diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 4f18d0526e6f..8d641a2818a5 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -304,10 +304,10 @@ def __init__(self, parent, handles, labels, if isinstance(parent, Axes): self.isaxes = True self.axes = parent - self.set_figure(parent.figure) + self.figure = parent.figure elif isinstance(parent, Figure): self.isaxes = False - self.set_figure(parent) + self.figure = parent else: raise TypeError("Legend needs either Axes or Figure as parent") self.parent = parent @@ -398,7 +398,7 @@ def _set_artist_props(self, a): """ set the boilerplate props for artists added to axes """ - a.set_figure(self.figure) + a.figure = self.figure if self.isaxes: # a.set_axes(self.axes) a.axes = self.axes @@ -714,7 +714,7 @@ def _init_legend_box(self, handles, labels, markerfirst=True): align="center", children=[self._legend_title_box, self._legend_handle_box]) - self._legend_box.set_figure(self.figure) + self._legend_box.figure = self.figure self.texts = text_list self.legendHandles = handle_list diff --git a/lib/matplotlib/legend_handler.py b/lib/matplotlib/legend_handler.py index 82fbea1f88cd..3ab29b470761 100644 --- a/lib/matplotlib/legend_handler.py +++ b/lib/matplotlib/legend_handler.py @@ -327,7 +327,7 @@ def update_prop(self, legend_handle, orig_handle, legend): self._update_prop(legend_handle, orig_handle) - legend_handle.set_figure(legend.figure) + legend_handle.figure = legend.figure #legend._set_artist_props(legend_handle) legend_handle.set_clip_box(None) legend_handle.set_clip_path(None) @@ -610,7 +610,7 @@ def get_first(prop_array): legend_handle.set_linewidth(get_first(orig_handle.get_linewidths())) legend_handle.set_linestyle(get_first(orig_handle.get_linestyles())) legend_handle.set_transform(get_first(orig_handle.get_transforms())) - legend_handle.set_figure(orig_handle.get_figure()) + legend_handle.figure = orig_handle.figure legend_handle.set_alpha(orig_handle.get_alpha()) def create_artists(self, legend, orig_handle, diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 932babbde485..9dcda2e2b8f4 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -183,9 +183,14 @@ def set_figure(self, fig): accepts a class:`~matplotlib.figure.Figure` instance """ - martist.Artist.set_figure(self, fig) + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + + @martist.Artist.figure.setter + def figure(self, fig): + martist.Artist.figure.__set__(self, fig) for c in self.get_children(): - c.set_figure(fig) + c.figure = fig def contains(self, mouseevent): for c in self.get_children(): @@ -1460,11 +1465,15 @@ def get_children(self): return children def set_figure(self, fig): + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + @martist.Artist.figure.setter + def figure(self, fig): if self.arrow_patch is not None: - self.arrow_patch.set_figure(fig) - self.offsetbox.set_figure(fig) - martist.Artist.set_figure(self, fig) + self.arrow_patch.figure = fig + self.offsetbox.figure = fig + martist.Artist.figure.__set__(self, fig) def set_fontsize(self, s=None): """ diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 6a120f0badd3..73256ad5c4b8 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -177,7 +177,7 @@ def update_from(self, other): self.set_linewidth(other.get_linewidth()) self.set_linestyle(other.get_linestyle()) self.set_transform(other.get_data_transform()) - self.set_figure(other.get_figure()) + self.figure = other.figure self.set_alpha(other.get_alpha()) def get_extents(self): diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index f2c7aab2d187..263df6af65b3 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -309,7 +309,7 @@ def _init(self): if self.color is not None: self.vector.set_color(self.color) self.vector.set_transform(self.Q.get_transform()) - self.vector.set_figure(self.get_figure()) + self.vector.figure = self.figure self._initialized = True def _text_x(self, x): @@ -351,8 +351,13 @@ def _set_transform(self): raise ValueError('unrecognized coordinates') def set_figure(self, fig): - martist.Artist.set_figure(self, fig) - self.text.set_figure(fig) + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + + @martist.Artist.figure.setter + def figure(self, fig): + martist.Artist.figure.__set__(self, fig) + self.text.figure = fig def contains(self, mouseevent): # Maybe the dictionary should allow one to diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index a68245086c31..248e499cf6fe 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -53,7 +53,7 @@ def __init__(self, axes, spine_type, path, **kwargs): """ super(Spine, self).__init__(**kwargs) self.axes = axes - self.set_figure(self.axes.figure) + self.figure = self.axes.figure self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index 2d8adfbd5db3..a78b710cce66 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -71,8 +71,13 @@ def set_transform(self, trans): self.stale = True def set_figure(self, fig): - Rectangle.set_figure(self, fig) - self._text.set_figure(fig) + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + + @Rectangle.figure.setter + def figure(self, fig): + Rectangle.figure.__set__(self, fig) + self._text.figure = fig def get_text(self): 'Return the cell Text intance' @@ -260,7 +265,7 @@ def __init__(self, ax, loc=None, bbox=None, **kwargs): loc = 'bottom' if is_string_like(loc): loc = self.codes.get(loc, 1) - self.set_figure(ax.figure) + self.figure = ax.figure self._axes = ax self._loc = loc self._bbox = bbox @@ -285,7 +290,7 @@ def add_cell(self, row, col, *args, **kwargs): xy = (0, 0) cell = CustomCell(xy, visible_edges=self.edges, *args, **kwargs) - cell.set_figure(self.figure) + cell.figure = self.figure cell.set_transform(self.get_transform()) cell.set_clip_on(False) diff --git a/lib/matplotlib/tests/test_text.py b/lib/matplotlib/tests/test_text.py index 6403fb018bf1..21dda68e0083 100644 --- a/lib/matplotlib/tests/test_text.py +++ b/lib/matplotlib/tests/test_text.py @@ -337,10 +337,10 @@ def test_text_annotation_get_window_extent(): # Only text annotation annotation = Annotation('test', xy=(0, 0)) - annotation.set_figure(figure) + annotation.figure = figure text = Text(text='test', x=0, y=0) - text.set_figure(figure) + text.figure = figure bbox = annotation.get_window_extent(renderer=renderer) @@ -410,7 +410,7 @@ def test_arrow_annotation_get_window_extent(): '', xy=(0.0, 50.0), xytext=(50.0, 50.0), xycoords='figure pixels', arrowprops={ 'facecolor': 'black', 'width': 8, 'headwidth': 10, 'shrink': 0.0}) - annotation.set_figure(figure) + annotation.figure = figure annotation.draw(renderer) bbox = annotation.get_window_extent() @@ -432,7 +432,7 @@ def test_empty_annotation_get_window_extent(): # Text annotation with arrow annotation = Annotation( '', xy=(0.0, 50.0), xytext=(0.0, 50.0), xycoords='figure pixels') - annotation.set_figure(figure) + annotation.figure = figure annotation.draw(renderer) bbox = annotation.get_window_extent() diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 4ee58f3f3e88..6832e664ca5f 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -628,7 +628,7 @@ def _get_wrap_line_width(self): current orientation. """ x0, y0 = self.get_transform().transform(self.get_position()) - figure_box = self.get_figure().get_window_extent() + figure_box = self.figure.get_window_extent() # Calculate available width based on text alignment alignment = self.get_horizontalalignment() @@ -1624,8 +1624,12 @@ def set_figure(self, fig): ACCEPTS: a :class:`matplotlib.figure.Figure` instance """ - Text.set_figure(self, fig) - self.dashline.set_figure(fig) + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + + @Text.figure.setter + def figure(self, fig): + Text.figure.__set__(self, fig) docstring.interpd.update(TextWithDash=artist.kwdoc(TextWithDash)) @@ -2081,12 +2085,16 @@ def anncoords(self, coords): self._textcoords = coords def set_figure(self, fig): + deprecated_get_set(self.__class__, self.set_figure, "figure") + self.figure = fig + @Text.figure.setter + def figure(self, fig): if self.arrow is not None: - self.arrow.set_figure(fig) + self.arrow.figure = fig if self.arrow_patch is not None: - self.arrow_patch.set_figure(fig) - Artist.set_figure(self, fig) + self.arrow_patch.figure = fig + Text.figure.__set__(self, fig) def update_positions(self, renderer): """"Update the pixel positions of the annotated point and the diff --git a/lib/mpl_toolkits/axes_grid/colorbar.py b/lib/mpl_toolkits/axes_grid/colorbar.py index 44c0b1936e75..3e8edeb95d3d 100644 --- a/lib/mpl_toolkits/axes_grid/colorbar.py +++ b/lib/mpl_toolkits/axes_grid/colorbar.py @@ -802,7 +802,7 @@ def make_axes(parent, **kw): panchor = (0.5, 0.0) parent.set_position(pb1) parent.set_anchor(panchor) - fig = parent.get_figure() + fig = parent.figure cax = fig.add_axes(pbcb) cax.set_aspect(aspect, anchor=anchor, adjustable='box') return cax, kw diff --git a/lib/mpl_toolkits/axes_grid1/axes_divider.py b/lib/mpl_toolkits/axes_grid1/axes_divider.py index 79424ecead6d..03de73737a79 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_divider.py +++ b/lib/mpl_toolkits/axes_grid1/axes_divider.py @@ -497,7 +497,7 @@ def __init__(self, axes, xref=None, yref=None): else: self._yref = yref - Divider.__init__(self, fig=axes.get_figure(), pos=None, + Divider.__init__(self, fig=axes.figure, pos=None, horizontal=[self._xref], vertical=[self._yref], aspect=None, anchor="C") @@ -512,7 +512,7 @@ def _get_new_axes(self, **kwargs): else: axes_class = type(axes) - ax = axes_class(axes.get_figure(), + ax = axes_class(axes.figure, axes.get_position(original=True), **kwargs) return ax diff --git a/lib/mpl_toolkits/axes_grid1/axes_rgb.py b/lib/mpl_toolkits/axes_grid1/axes_rgb.py index d00e3b8418e6..1f6ad936da10 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_rgb.py +++ b/lib/mpl_toolkits/axes_grid1/axes_rgb.py @@ -34,7 +34,7 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True): axes_class = locatable_axes_factory(type(ax)) for ny in [4, 2, 0]: - ax1 = axes_class(ax.get_figure(), + ax1 = axes_class(ax.figure, ax.get_position(original=True), sharex=ax, sharey=ax) locator = divider.new_locator(nx=2, ny=ny) @@ -50,7 +50,7 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True): ax_rgb.append(ax1) if add_all: - fig = ax.get_figure() + fig = ax.figure for ax1 in ax_rgb: fig.add_axes(ax1) @@ -144,7 +144,7 @@ def __init__(self, *kl, **kwargs): ax_rgb = [] for ny in [4, 2, 0]: - ax1 = axes_class(ax.get_figure(), + ax1 = axes_class(ax.figure, ax.get_position(original=True), sharex=ax, sharey=ax, **kwargs) locator = divider.new_locator(nx=2, ny=ny) @@ -156,7 +156,7 @@ def __init__(self, *kl, **kwargs): self.R, self.G, self.B = ax_rgb if add_all: - fig = ax.get_figure() + fig = ax.figure fig.add_axes(ax) self.add_RGB_to_figure() @@ -177,9 +177,9 @@ def _config_axes(self, line_color='w', marker_edge_color='w'): def add_RGB_to_figure(self): """Add the red, green and blue axes to the RGB composite's axes figure """ - self.RGB.get_figure().add_axes(self.R) - self.RGB.get_figure().add_axes(self.G) - self.RGB.get_figure().add_axes(self.B) + self.RGB.figure.add_axes(self.R) + self.RGB.figure.add_axes(self.G) + self.RGB.figure.add_axes(self.B) def imshow_rgb(self, r, g, b, **kwargs): """Create the four images {rgb, r, g, b} diff --git a/lib/mpl_toolkits/axes_grid1/axes_size.py b/lib/mpl_toolkits/axes_grid1/axes_size.py index 946db5157dc6..10508cb37f63 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_size.py +++ b/lib/mpl_toolkits/axes_grid1/axes_size.py @@ -162,7 +162,7 @@ def get_size(self, renderer): bb = a.get_window_extent(renderer) w_list.append(bb.width) h_list.append(bb.height) - dpi = a.get_figure().get_dpi() + dpi = a.figure.get_dpi() if self._w_or_h == "width": abs_size = max(w_list)/dpi elif self._w_or_h == "height": @@ -188,7 +188,7 @@ def get_size(self, renderer): for a in self._artist_list: bb = a.get_window_extent(renderer) w_list.append(bb.width) - dpi = a.get_figure().get_dpi() + dpi = a.figure.get_dpi() abs_size = max(w_list)/dpi return rel_size, abs_size @@ -212,7 +212,7 @@ def get_size(self, renderer): for a in self._artist_list: bb = a.get_window_extent(renderer) h_list.append(bb.height) - dpi = a.get_figure().get_dpi() + dpi = a.figure.get_dpi() abs_size = max(h_list)/dpi return rel_size, abs_size diff --git a/lib/mpl_toolkits/axes_grid1/colorbar.py b/lib/mpl_toolkits/axes_grid1/colorbar.py index 4268502dbd75..85887bdc735b 100644 --- a/lib/mpl_toolkits/axes_grid1/colorbar.py +++ b/lib/mpl_toolkits/axes_grid1/colorbar.py @@ -803,7 +803,7 @@ def make_axes(parent, **kw): panchor = (0.5, 0.0) parent.set_position(pb1) parent.set_anchor(panchor) - fig = parent.get_figure() + fig = parent.figure cax = fig.add_axes(pbcb) cax.set_aspect(aspect, anchor=anchor, adjustable='box') return cax, kw diff --git a/lib/mpl_toolkits/axisartist/axis_artist.py b/lib/mpl_toolkits/axisartist/axis_artist.py index 6b1904673f71..326dc216b38e 100644 --- a/lib/mpl_toolkits/axisartist/axis_artist.py +++ b/lib/mpl_toolkits/axisartist/axis_artist.py @@ -1413,7 +1413,7 @@ def _init_label(self, **kw): axis_direction=self._axis_direction, ) - self.label.set_figure(self.axes.figure) + self.label.figure = self.axes.figure labelpad = kw.get("labelpad", 5) self.label.set_pad(labelpad) diff --git a/lib/mpl_toolkits/axisartist/floating_axes.py b/lib/mpl_toolkits/axisartist/floating_axes.py index c7c03c137340..748236e04231 100644 --- a/lib/mpl_toolkits/axisartist/floating_axes.py +++ b/lib/mpl_toolkits/axisartist/floating_axes.py @@ -496,7 +496,7 @@ def cla(self): patch = self._axes_class_floating._gen_axes_patch(self) - patch.set_figure(self.figure) + patch.figure = self.figure patch.set_visible(False) patch.set_transform(self.transAxes) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy