File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -813,17 +813,12 @@ def delaxes(ax=None):
813
813
814
814
def sca (ax ):
815
815
"""
816
- Set the current Axes instance to *ax*.
817
-
818
- The current Figure is updated to the parent of *ax*.
816
+ Set the current Axes to *ax* and the current Figure to the parent of *ax*.
819
817
"""
820
- managers = _pylab_helpers .Gcf .get_all_fig_managers ()
821
- for m in managers :
822
- if ax in m .canvas .figure .axes :
823
- _pylab_helpers .Gcf .set_active (m )
824
- m .canvas .figure .sca (ax )
825
- return
826
- raise ValueError ("Axes instance argument was not found in a figure" )
818
+ if not hasattr (ax .figure .canvas , "manager" ):
819
+ raise ValueError ("Axes parent figure is not managed by pyplot" )
820
+ _pylab_helpers .Gcf .set_active (ax .figure .canvas .manager )
821
+ ax .figure .sca (ax )
827
822
828
823
829
824
## More ways of creating axes ##
You can’t perform that action at this time.
0 commit comments