Skip to content

Commit 712116b

Browse files
committed
Test pyplot.axes(ax) with ax from other figure.
Ensure `ax` becomes the current axis and its parent the current figure.
1 parent 37d7f1f commit 712116b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,15 @@ def _as_mpl_axes(self):
14761476
'Expected a PolarAxesSubplot, got %s' % type(ax)
14771477
plt.close()
14781478

1479+
# test focusing of Axes in other Figure
1480+
fig1, ax1 = subplots()
1481+
fig2, ax2 = subplots()
1482+
assert ax1 is plt.axes(ax1)
1483+
assert ax1 is plt.gca()
1484+
assert fig1 is plt.gcf()
1485+
plt.close(fig1)
1486+
plt.close(fig2)
1487+
14791488

14801489
@image_comparison(baseline_images=['log_scales'])
14811490
def test_log_scales():

0 commit comments

Comments
 (0)