File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -875,7 +875,8 @@ def axes(*args, **kwargs):
875
875
color for the axis, default white.
876
876
877
877
- ``axes(h)`` where *h* is an axes instance makes *h* the current
878
- axis. An :class:`~matplotlib.axes.Axes` instance is returned.
878
+ axis and the parent of *h* the current figure.
879
+ An :class:`~matplotlib.axes.Axes` instance is returned.
879
880
880
881
========= ============== ==============================================
881
882
kwarg Accepts Description
@@ -909,7 +910,8 @@ def axes(*args, **kwargs):
909
910
arg = args [0 ]
910
911
911
912
if isinstance (arg , Axes ):
912
- a = gcf ().sca (arg )
913
+ sca (arg )
914
+ a = arg
913
915
else :
914
916
rect = arg
915
917
a = gcf ().add_axes (rect , ** kwargs )
Original file line number Diff line number Diff line change @@ -1477,6 +1477,17 @@ def _as_mpl_axes(self):
1477
1477
plt .close ()
1478
1478
1479
1479
1480
+ def test_pyplot_axes ():
1481
+ # test focusing of Axes in other Figure
1482
+ fig1 , ax1 = plt .subplots ()
1483
+ fig2 , ax2 = plt .subplots ()
1484
+ assert ax1 is plt .axes (ax1 )
1485
+ assert ax1 is plt .gca ()
1486
+ assert fig1 is plt .gcf ()
1487
+ plt .close (fig1 )
1488
+ plt .close (fig2 )
1489
+
1490
+
1480
1491
@image_comparison (baseline_images = ['log_scales' ])
1481
1492
def test_log_scales ():
1482
1493
fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments