Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitb76a868

Browse files
committed
Provide deprecation pathway
1 parent3546b4b commitb76a868

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

‎lib/matplotlib/patches.py

Lines 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

Lines 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+
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7416+
rec,connectors=ax.indicate_inset_zoom(axin1)
74167417
for_inrange(2):
74177418
# Drawing twice should not affect result
74187419
fig.canvas.draw()
7419-
assertlen(inset.connectors)==4
7420+
assertlen(connectors)==4
74207421
xx=np.array([[1.5,2.],
74217422
[2.15,2.5]])
7422-
assertnp.all(inset.get_bbox().get_points()==xx)
7423+
assertnp.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=-1ifx_invertedelse1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp