@@ -1736,7 +1736,7 @@ def set_adjustable(self, adjustable, share=False):
1736
1736
and any (getattr (ax .get_data_ratio , "__func__" , None )
1737
1737
!= _AxesBase .get_data_ratio
1738
1738
for ax in axs )):
1739
- # Limits adjustment by apply_aspect assumes that the axes' aspect
1739
+ # Limits adjustment by _apply_aspect assumes that the axes' aspect
1740
1740
# ratio can be computed from the data limits and scales.
1741
1741
raise ValueError ("Cannot set Axes adjustable to 'datalim' for "
1742
1742
"Axes which override 'get_data_ratio'" )
@@ -1870,6 +1870,7 @@ def get_data_ratio(self):
1870
1870
ysize = max (abs (tymax - tymin ), 1e-30 )
1871
1871
return ysize / xsize
1872
1872
1873
+ @_api .delete_parameter ("3.6" , "position" )
1873
1874
def apply_aspect (self , position = None ):
1874
1875
"""
1875
1876
Adjust the Axes for a specified data aspect ratio.
@@ -1881,10 +1882,17 @@ def apply_aspect(self, position=None):
1881
1882
Parameters
1882
1883
----------
1883
1884
position : None or .Bbox
1885
+
1884
1886
If not ``None``, this defines the position of the
1885
1887
Axes within the figure as a Bbox. See `~.Axes.get_position`
1886
1888
for further details.
1887
1889
1890
+ .. admonition:: Deprecated
1891
+
1892
+ Changing the *position* through ``apply_aspect`` is
1893
+ considered internal API. This parameter will be removed
1894
+ in the future.
1895
+
1888
1896
Notes
1889
1897
-----
1890
1898
This is called automatically when each Axes is drawn. You may need
@@ -1900,6 +1908,23 @@ def apply_aspect(self, position=None):
1900
1908
matplotlib.axes.Axes.set_anchor
1901
1909
Set the position in case of extra space.
1902
1910
"""
1911
+ # Note: This method is a thin wrapper that only exists for the purpose
1912
+ # of not exposing the position parameter as public API.
1913
+ self ._apply_aspect (position )
1914
+
1915
+ def _apply_aspect (self , position = None ):
1916
+ """
1917
+ Adjust the Axes for a specified data aspect ratio.
1918
+
1919
+ See the docstring of the public `apply_aspect` method.
1920
+
1921
+ Parameters
1922
+ ----------
1923
+ position : None or .Bbox
1924
+ If not ``None``, this defines the position of the
1925
+ Axes within the figure as a Bbox. See `~.Axes.get_position`
1926
+ for further details.
1927
+ """
1903
1928
if position is None :
1904
1929
position = self .get_position (original = True )
1905
1930
@@ -2998,7 +3023,7 @@ def _update_title_position(self, renderer):
2998
3023
2999
3024
for ax in self .child_axes : # Child positions must be updated first.
3000
3025
locator = ax .get_axes_locator ()
3001
- ax .apply_aspect (locator (self , renderer ) if locator else None )
3026
+ ax ._apply_aspect (locator (self , renderer ) if locator else None )
3002
3027
3003
3028
top = - np .inf
3004
3029
for ax in axs :
@@ -3061,7 +3086,7 @@ def draw(self, renderer):
3061
3086
3062
3087
# loop over self and child Axes...
3063
3088
locator = self .get_axes_locator ()
3064
- self .apply_aspect (locator (self , renderer ) if locator else None )
3089
+ self ._apply_aspect (locator (self , renderer ) if locator else None )
3065
3090
3066
3091
artists = self .get_children ()
3067
3092
artists .remove (self .patch )
@@ -4444,7 +4469,7 @@ def get_tightbbox(self, renderer=None, call_axes_locator=True,
4444
4469
return None
4445
4470
4446
4471
locator = self .get_axes_locator ()
4447
- self .apply_aspect (
4472
+ self ._apply_aspect (
4448
4473
locator (self , renderer ) if locator and call_axes_locator else None )
4449
4474
4450
4475
for axis in self ._axis_map .values ():
0 commit comments