There was an error while loading. Please reload this page.
1 parent 3546b4b commit b76a868Copy full SHA for b76a868
2 files changed
lib/matplotlib/patches.py
@@ -4817,3 +4817,11 @@ def draw(self, renderer):
4817
4818
# Just draw the rectangle
4819
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
@@ -7412,14 +7412,15 @@ def test_zoom_inset():
7412
axin1.set_ylim([2, 2.5])
7413
axin1.set_aspect(ax.get_aspect())
7414
7415
- inset = ax.indicate_inset_zoom(axin1)
+ with pytest.warns(mpl.MatplotlibDeprecationWarning):
7416
+ rec, connectors = ax.indicate_inset_zoom(axin1)
7417
for _ in range(2):
7418
# Drawing twice should not affect result
7419
fig.canvas.draw()
- assert len(inset.connectors) == 4
7420
+ assert len(connectors) == 4
7421
xx = np.array([[1.5, 2.],
7422
[2.15, 2.5]])
- assert np.all(inset.get_bbox().get_points() == xx)
7423
+ assert np.all(rec.get_bbox().get_points() == xx)
7424
xx = np.array([[0.6325, 0.692308],
7425
[0.8425, 0.907692]])
7426
np.testing.assert_allclose(
@@ -7520,7 +7521,6 @@ def test_indicate_inset_inverted(x_inverted, y_inverted):
7520
7521
ax1.invert_yaxis()
7522
7523
inset = ax1.indicate_inset([2, 2, 5, 4], ax2)
- fig.draw_without_rendering()
7524
lower_left, upper_left, lower_right, upper_right = inset.connectors
7525
7526
sign_x = -1 if x_inverted else 1
0 commit comments