File tree 2 files changed +12
-4
lines changed
Filter options
2 files changed +12
-4
lines changed
Original file line number Diff line number Diff line change @@ -4817,3 +4817,11 @@ def draw(self, renderer):
4817
4817
4818
4818
# Just draw the rectangle
4819
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 ]
Original file line number Diff line number Diff line change @@ -7412,14 +7412,15 @@ def test_zoom_inset():
7412
7412
axin1 .set_ylim ([2 , 2.5 ])
7413
7413
axin1 .set_aspect (ax .get_aspect ())
7414
7414
7415
- inset = ax .indicate_inset_zoom (axin1 )
7415
+ with pytest .warns (mpl .MatplotlibDeprecationWarning ):
7416
+ rec , connectors = ax .indicate_inset_zoom (axin1 )
7416
7417
for _ in range (2 ):
7417
7418
# Drawing twice should not affect result
7418
7419
fig .canvas .draw ()
7419
- assert len (inset . connectors ) == 4
7420
+ assert len (connectors ) == 4
7420
7421
xx = np .array ([[1.5 , 2. ],
7421
7422
[2.15 , 2.5 ]])
7422
- assert np .all (inset .get_bbox ().get_points () == xx )
7423
+ assert np .all (rec .get_bbox ().get_points () == xx )
7423
7424
xx = np .array ([[0.6325 , 0.692308 ],
7424
7425
[0.8425 , 0.907692 ]])
7425
7426
np .testing .assert_allclose (
@@ -7520,7 +7521,6 @@ def test_indicate_inset_inverted(x_inverted, y_inverted):
7520
7521
ax1 .invert_yaxis ()
7521
7522
7522
7523
inset = ax1 .indicate_inset ([2 , 2 , 5 , 4 ], ax2 )
7523
- fig .draw_without_rendering ()
7524
7524
lower_left , upper_left , lower_right , upper_right = inset .connectors
7525
7525
7526
7526
sign_x = - 1 if x_inverted else 1
You can’t perform that action at this time.
0 commit comments