Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22bb527

Browse files
committed
Deprecate accepting arbitrary parameters in some get_window_extent() methods
1 parent d6ed6ce commit 22bb527

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``Axes.get_window_extent`` and ``Figure.get_window_extent`` won't accept parameters other than *renderer* anymore
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
This aligns the API with the general `.Artist.get_window_extent` API.
4+
All parameters were ignored anyway.

lib/matplotlib/axes/_base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,16 @@ def get_window_extent(self, *args, **kwargs):
734734
matplotlib.axis.Axis.get_tightbbox
735735
matplotlib.spines.Spine.get_window_extent
736736
"""
737+
kwargs.pop('renderer', None)
738+
if len(args) > 1 or kwargs:
739+
# when this expires coerce the API to
740+
# get_window_extent(renderer=None) in line with
741+
# Artist.get_window_extent
742+
_api.warn_deprecated(
743+
"3.6",
744+
message="Passing any argument except 'renderer' to "
745+
"Axes.get_window_extent is deprecated in Matplotlib "
746+
"%(since)s and will be removed %(removal)s")
737747
return self.bbox
738748

739749
def _init_axis(self):

lib/matplotlib/figure.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,16 @@ def contains(self, mouseevent):
318318

319319
def get_window_extent(self, *args, **kwargs):
320320
# docstring inherited
321+
kwargs.pop('renderer', None)
322+
if len(args) > 1 or kwargs:
323+
# when this expires coerce the API to
324+
# get_window_extent(renderer=None) in line with
325+
# Artist.get_window_extent
326+
_api.warn_deprecated(
327+
"3.6",
328+
message="Passing any argument except 'renderer' to "
329+
"Figure.get_window_extent is deprecated in Matplotlib "
330+
"%(since)s and will be removed %(removal)s")
321331
return self.bbox
322332

323333
def _suplabels(self, t, info, **kwargs):

0 commit comments

Comments
 (0)