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

Skip to content

Commit ccc6fc4

Browse files
committed
Deprecate inset_locator.InsetPosition.
There's Axes.inset_axes which is an exact replacement without the need of actually understanding what an axes locator is, and which is also more general as one can also set a custom transform on inset_axes instead of being limited to the transAxes of a given parent axes. Also the method had never been used in the library or examples, and a test was only ever added in 6dd30a2 (2022).
1 parent a861b8a commit ccc6fc4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``inset_location.InsetPosition`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Use `~.Axes.inset_axes` instead.

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .parasite_axes import HostAxes
1414

1515

16+
@_api.deprecated("3.8", alternative="Axes.inset_axes")
1617
class InsetPosition:
1718
@_docstring.dedent_interpd
1819
def __init__(self, parent, lbwh):

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ def test_rgb_axes():
691691
def test_insetposition():
692692
fig, ax = plt.subplots(figsize=(2, 2))
693693
ax_ins = plt.axes([0, 0, 1, 1])
694-
ip = InsetPosition(ax, [0.2, 0.25, 0.5, 0.4])
694+
with pytest.warns(mpl.MatplotlibDeprecationWarning):
695+
ip = InsetPosition(ax, [0.2, 0.25, 0.5, 0.4])
695696
ax_ins.set_axes_locator(ip)
696697

697698

0 commit comments

Comments
 (0)