Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b76a868

Browse filesBrowse files
committed
Provide deprecation pathway
1 parent 3546b4b commit b76a868
Copy full SHA for b76a868

File tree

2 files changed

+12
-4
lines changed
Filter options

2 files changed

+12
-4
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4817,3 +4817,11 @@ def draw(self, renderer):
48174817

48184818
# Just draw the rectangle
48194819
super().draw(renderer)
4820+
4821+
@_api.deprecated(
4822+
'3.10',
4823+
message=('Since Matplotlib 3.10 indicate_inset_[zoom] returns a single '
4824+
'IndicateInset patch with a connectors property. From 3.12 it will '
4825+
'no longer be possible to unpack the return value into two elements.'))
4826+
def __getitem__(self, key):
4827+
return [self, self.connectors][key]

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7412,14 +7412,15 @@ def test_zoom_inset():
74127412
axin1.set_ylim([2, 2.5])
74137413
axin1.set_aspect(ax.get_aspect())
74147414

7415-
inset = ax.indicate_inset_zoom(axin1)
7415+
with pytest.warns(mpl.MatplotlibDeprecationWarning):
7416+
rec, connectors = ax.indicate_inset_zoom(axin1)
74167417
for _ in range(2):
74177418
# Drawing twice should not affect result
74187419
fig.canvas.draw()
7419-
assert len(inset.connectors) == 4
7420+
assert len(connectors) == 4
74207421
xx = np.array([[1.5, 2.],
74217422
[2.15, 2.5]])
7422-
assert np.all(inset.get_bbox().get_points() == xx)
7423+
assert np.all(rec.get_bbox().get_points() == xx)
74237424
xx = np.array([[0.6325, 0.692308],
74247425
[0.8425, 0.907692]])
74257426
np.testing.assert_allclose(
@@ -7520,7 +7521,6 @@ def test_indicate_inset_inverted(x_inverted, y_inverted):
75207521
ax1.invert_yaxis()
75217522

75227523
inset = ax1.indicate_inset([2, 2, 5, 4], ax2)
7523-
fig.draw_without_rendering()
75247524
lower_left, upper_left, lower_right, upper_right = inset.connectors
75257525

75267526
sign_x = -1 if x_inverted else 1

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.