File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -875,7 +875,8 @@ def axes(*args, **kwargs):
875875 color for the axis, default white.
876876
877877 - ``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.
879880
880881 ========= ============== ==============================================
881882 kwarg Accepts Description
@@ -909,7 +910,8 @@ def axes(*args, **kwargs):
909910 arg = args [0 ]
910911
911912 if isinstance (arg , Axes ):
912- a = gcf ().sca (arg )
913+ sca (arg )
914+ a = arg
913915 else :
914916 rect = arg
915917 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):
14771477 plt .close ()
14781478
14791479
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+
14801491@image_comparison (baseline_images = ['log_scales' ])
14811492def test_log_scales ():
14821493 fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments