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

Skip to content

Commit 57c4ddf

Browse files
committed
Temporary: Do we really want this?
1 parent 0a26da5 commit 57c4ddf

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
The parameter *position* in ``Axes.apply_aspect()``
2-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3-
... is deprecated. It is considered internal API and now public use case is known.
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated. It is considered internal API and no public use case is known.

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def inset_axes(self, bounds, *, transform=None, zorder=5, **kwargs):
410410
inset_ax = projection_class(self.figure, bounds, zorder=zorder, **pkw)
411411

412412
# this locator lets the axes move if in data coordinates.
413-
# it gets called in `ax._apply_aspect() (of all places)
413+
# it gets called in `ax.apply_aspect() (of all places)
414414
inset_ax.set_axes_locator(inset_locator)
415415

416416
self.add_child_axes(inset_ax)

lib/matplotlib/axes/_base.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ def set_adjustable(self, adjustable, share=False):
17361736
and any(getattr(ax.get_data_ratio, "__func__", None)
17371737
!= _AxesBase.get_data_ratio
17381738
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
17401740
# ratio can be computed from the data limits and scales.
17411741
raise ValueError("Cannot set Axes adjustable to 'datalim' for "
17421742
"Axes which override 'get_data_ratio'")
@@ -1870,7 +1870,7 @@ def get_data_ratio(self):
18701870
ysize = max(abs(tymax - tymin), 1e-30)
18711871
return ysize / xsize
18721872

1873-
@_api.delete_parameter("3.6", "position")
1873+
@_api.delete_parameter("3.10", "position")
18741874
def apply_aspect(self, position=None):
18751875
"""
18761876
Adjust the Axes for a specified data aspect ratio.
@@ -1882,12 +1882,11 @@ def apply_aspect(self, position=None):
18821882
Parameters
18831883
----------
18841884
position : None or .Bbox
1885-
18861885
If not ``None``, this defines the position of the
18871886
Axes within the figure as a Bbox. See `~.Axes.get_position`
18881887
for further details.
18891888
1890-
.. admonition:: Deprecated
1889+
.. deprecated:: 3.10
18911890
18921891
Changing the *position* through ``apply_aspect`` is
18931892
considered internal API. This parameter will be removed
@@ -1918,6 +1917,19 @@ def _apply_aspect(self, position=None):
19181917
19191918
See the docstring of the public `apply_aspect` method.
19201919
1920+
.. note::
1921+
1922+
It is somewhat surprising that "_apply_aspect" takes an optional
1923+
position as input, which seems more functionality than what the
1924+
name suggests.
1925+
1926+
Generally, applying an aspect will modify the size and position
1927+
of an Axes. I haven't been able to reconstruct the history but
1928+
assume, the fact that position is updated anyway was used to
1929+
funnel additional position constraints into the already existing
1930+
code. Likely, this function should better be called
1931+
_update_geometry() nowadays.
1932+
19211933
Parameters
19221934
----------
19231935
position : None or .Bbox

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ def set_location(self, location, transform=None):
139139
# it gets called in ax._apply_aspect() (of all places)
140140
self.set_axes_locator(_TransformedBoundsLocator(bounds, transform))
141141

142-
def _apply_aspect(self, position=None):
142+
def apply_aspect(self, position=None):
143143
# docstring inherited.
144144
self._set_lims()
145-
super()._apply_aspect(position)
145+
super().apply_aspect(position)
146146

147147
@_docstring.copy(Axis.set_ticks)
148148
def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):

0 commit comments

Comments
 (0)