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 @@ -838,17 +838,12 @@ def delaxes(ax=None):
838
838
839
839
def sca (ax ):
840
840
"""
841
- Set the current Axes instance to *ax*.
842
-
843
- The current Figure is updated to the parent of *ax*.
841
+ Set the current Axes to *ax* and the current Figure to the parent of *ax*.
844
842
"""
845
- managers = _pylab_helpers .Gcf .get_all_fig_managers ()
846
- for m in managers :
847
- if ax in m .canvas .figure .axes :
848
- _pylab_helpers .Gcf .set_active (m )
849
- m .canvas .figure .sca (ax )
850
- return
851
- raise ValueError ("Axes instance argument was not found in a figure" )
843
+ if not hasattr (ax .figure .canvas , "manager" ):
844
+ raise ValueError ("Axes parent figure is not managed by pyplot" )
845
+ _pylab_helpers .Gcf .set_active (ax .figure .canvas .manager )
846
+ ax .figure .sca (ax )
852
847
853
848
854
849
def gca (** kwargs ):
You can’t perform that action at this time.
0 commit comments