diff --git a/doc/api/next_api_changes/deprecations/22123-TH.rst b/doc/api/next_api_changes/deprecations/22123-TH.rst new file mode 100644 index 000000000000..5b65ac760bd6 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/22123-TH.rst @@ -0,0 +1,4 @@ +``Axes.get_window_extent`` and ``Figure.get_window_extent`` won't accept parameters other than *renderer* anymore +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This aligns the API with the general `.Artist.get_window_extent` API. +All parameters were ignored anyway. diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index f54e8fd9a500..6a289ad65be4 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -719,7 +719,9 @@ def __repr__(self): fields += [f"ylabel={self.get_ylabel()!r}"] return f"<{self.__class__.__name__}:" + ", ".join(fields) + ">" - def get_window_extent(self, *args, **kwargs): + @_api.delete_parameter("3.6", "args") + @_api.delete_parameter("3.6", "kwargs") + def get_window_extent(self, renderer=None, *args, **kwargs): """ Return the Axes bounding box in display space; *args* and *kwargs* are empty. diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index fb57acec9f1a..e53fc27ba95f 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -316,7 +316,9 @@ def contains(self, mouseevent): inside = self.bbox.contains(mouseevent.x, mouseevent.y) return inside, {} - def get_window_extent(self, *args, **kwargs): + @_api.delete_parameter("3.6", "args") + @_api.delete_parameter("3.6", "kwargs") + def get_window_extent(self, renderer=None, *args, **kwargs): # docstring inherited return self.bbox