@@ -1719,7 +1719,7 @@ def set_adjustable(self, adjustable, share=False):
1719
1719
and any (getattr (ax .get_data_ratio , "__func__" , None )
1720
1720
!= _AxesBase .get_data_ratio
1721
1721
for ax in axs )):
1722
- # Limits adjustment by apply_aspect assumes that the axes' aspect
1722
+ # Limits adjustment by _apply_aspect assumes that the axes' aspect
1723
1723
# ratio can be computed from the data limits and scales.
1724
1724
raise ValueError ("Cannot set Axes adjustable to 'datalim' for "
1725
1725
"Axes which override 'get_data_ratio'" )
@@ -1855,6 +1855,7 @@ def get_data_ratio(self):
1855
1855
ysize = max (abs (tymax - tymin ), 1e-30 )
1856
1856
return ysize / xsize
1857
1857
1858
+ @_api .delete_parameter ("3.6" , "position" )
1858
1859
def apply_aspect (self , position = None ):
1859
1860
"""
1860
1861
Adjust the Axes for a specified data aspect ratio.
@@ -1866,10 +1867,17 @@ def apply_aspect(self, position=None):
1866
1867
Parameters
1867
1868
----------
1868
1869
position : None or .Bbox
1870
+
1869
1871
If not ``None``, this defines the position of the
1870
1872
Axes within the figure as a Bbox. See `~.Axes.get_position`
1871
1873
for further details.
1872
1874
1875
+ .. admonition:: Deprecated
1876
+
1877
+ Changing the *position* through ``apply_aspect`` is
1878
+ considered internal API. This parameter will be removed
1879
+ in the future.
1880
+
1873
1881
Notes
1874
1882
-----
1875
1883
This is called automatically when each Axes is drawn. You may need
@@ -1885,6 +1893,23 @@ def apply_aspect(self, position=None):
1885
1893
matplotlib.axes.Axes.set_anchor
1886
1894
Set the position in case of extra space.
1887
1895
"""
1896
+ # Note: This method is a thin wrapper that only exists for the purpose
1897
+ # of not exposing the position parameter as public API.
1898
+ self ._apply_aspect (position )
1899
+
1900
+ def _apply_aspect (self , position = None ):
1901
+ """
1902
+ Adjust the Axes for a specified data aspect ratio.
1903
+
1904
+ See the docstring of the public `apply_aspect` method.
1905
+
1906
+ Parameters
1907
+ ----------
1908
+ position : None or .Bbox
1909
+ If not ``None``, this defines the position of the
1910
+ Axes within the figure as a Bbox. See `~.Axes.get_position`
1911
+ for further details.
1912
+ """
1888
1913
if position is None :
1889
1914
position = self .get_position (original = True )
1890
1915
@@ -2958,7 +2983,7 @@ def _update_title_position(self, renderer):
2958
2983
axs = self ._twinned_axes .get_siblings (self ) + self .child_axes
2959
2984
for ax in self .child_axes : # Child positions must be updated first.
2960
2985
locator = ax .get_axes_locator ()
2961
- ax .apply_aspect (locator (self , renderer ) if locator else None )
2986
+ ax ._apply_aspect (locator (self , renderer ) if locator else None )
2962
2987
2963
2988
for title in titles :
2964
2989
x , _ = title .get_position ()
@@ -3021,7 +3046,7 @@ def draw(self, renderer):
3021
3046
3022
3047
# loop over self and child Axes...
3023
3048
locator = self .get_axes_locator ()
3024
- self .apply_aspect (locator (self , renderer ) if locator else None )
3049
+ self ._apply_aspect (locator (self , renderer ) if locator else None )
3025
3050
3026
3051
artists = self .get_children ()
3027
3052
artists .remove (self .patch )
@@ -4386,7 +4411,7 @@ def get_tightbbox(self, renderer=None, call_axes_locator=True,
4386
4411
return None
4387
4412
4388
4413
locator = self .get_axes_locator ()
4389
- self .apply_aspect (
4414
+ self ._apply_aspect (
4390
4415
locator (self , renderer ) if locator and call_axes_locator else None )
4391
4416
4392
4417
for axis in self ._axis_map .values ():
0 commit comments