diff --git a/doc/api/next_api_changes/deprecations/24990-OG.rst b/doc/api/next_api_changes/deprecations/24990-OG.rst new file mode 100644 index 000000000000..180be1fd7659 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/24990-OG.rst @@ -0,0 +1,5 @@ +Arguments other than ``renderer`` to ``get_tightbbox`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... are keyword-only arguments. This is for consistency and that +different classes have different additional arguments. diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index d10b4e020056..d97a86224a2e 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -4328,6 +4328,7 @@ def get_default_bbox_extra_artists(self): return [a for a in artists if a.get_visible() and a.get_in_layout() and (isinstance(a, noclip) or not a._fully_clipped_to_axes())] + @_api.make_keyword_only("3.8", "call_axes_locator") def get_tightbbox(self, renderer=None, call_axes_locator=True, bbox_extra_artists=None, *, for_layout_only=False): """ diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 7b273cf9fb81..986bb85f3fc3 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1688,6 +1688,7 @@ def get_default_bbox_extra_artists(self): bbox_artists.extend(ax.get_default_bbox_extra_artists()) return bbox_artists + @_api.make_keyword_only("3.8", "bbox_extra_artists") def get_tightbbox(self, renderer=None, bbox_extra_artists=None): """ Return a (tight) bounding box of the figure *in inches*. diff --git a/lib/mpl_toolkits/axes_grid1/parasite_axes.py b/lib/mpl_toolkits/axes_grid1/parasite_axes.py index b8781a18c22b..cafd06adba2e 100644 --- a/lib/mpl_toolkits/axes_grid1/parasite_axes.py +++ b/lib/mpl_toolkits/axes_grid1/parasite_axes.py @@ -215,6 +215,7 @@ def _remove_any_twin(self, ax): self.axis[tuple(restore)].set_visible(True) self.axis[tuple(restore)].toggle(ticklabels=False, label=False) + @_api.make_keyword_only("3.8", "call_axes_locator") def get_tightbbox(self, renderer=None, call_axes_locator=True, bbox_extra_artists=None): bbs = [ diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index f9a48136285a..3acf91d5d69c 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -3181,6 +3181,7 @@ def _digout_minmax(err_arr, coord_label): return errlines, caplines, limmarks + @_api.make_keyword_only("3.8", "call_axes_locator") def get_tightbbox(self, renderer=None, call_axes_locator=True, bbox_extra_artists=None, *, for_layout_only=False): ret = super().get_tightbbox(renderer,