@@ -3252,20 +3252,26 @@ def set_xscale(self, value, **kwargs):
3252
3252
- `matplotlib.scale.SymmetricalLogScale`
3253
3253
- `matplotlib.scale.LogitScale`
3254
3254
3255
-
3256
3255
Notes
3257
3256
-----
3258
3257
By default, Matplotlib supports the above mentioned scales.
3259
3258
Additionally, custom scales may be registered using
3260
3259
`matplotlib.scale.register_scale`. These scales can then also
3261
3260
be used here.
3262
3261
"""
3262
+ old_default_lims = (self .xaxis .get_major_locator ()
3263
+ .nonsingular (- np .inf , np .inf ))
3263
3264
g = self .get_shared_x_axes ()
3264
3265
for ax in g .get_siblings (self ):
3265
3266
ax .xaxis ._set_scale (value , ** kwargs )
3266
3267
ax ._update_transScale ()
3267
3268
ax .stale = True
3268
- self ._request_autoscale_view (scaley = False )
3269
+ new_default_lims = (self .xaxis .get_major_locator ()
3270
+ .nonsingular (- np .inf , np .inf ))
3271
+ if old_default_lims != new_default_lims :
3272
+ # Force autoscaling now, to take advantage of the scale locator's
3273
+ # nonsingular() before it possibly gets swapped out by the user.
3274
+ self .autoscale_view (scaley = False )
3269
3275
3270
3276
@cbook ._make_keyword_only ("3.2" , "minor" )
3271
3277
def get_xticks (self , minor = False ):
@@ -3637,20 +3643,26 @@ def set_yscale(self, value, **kwargs):
3637
3643
- `matplotlib.scale.SymmetricalLogScale`
3638
3644
- `matplotlib.scale.LogitScale`
3639
3645
3640
-
3641
3646
Notes
3642
3647
-----
3643
3648
By default, Matplotlib supports the above mentioned scales.
3644
3649
Additionally, custom scales may be registered using
3645
3650
`matplotlib.scale.register_scale`. These scales can then also
3646
3651
be used here.
3647
3652
"""
3653
+ old_default_lims = (self .yaxis .get_major_locator ()
3654
+ .nonsingular (- np .inf , np .inf ))
3648
3655
g = self .get_shared_y_axes ()
3649
3656
for ax in g .get_siblings (self ):
3650
3657
ax .yaxis ._set_scale (value , ** kwargs )
3651
3658
ax ._update_transScale ()
3652
3659
ax .stale = True
3653
- self ._request_autoscale_view (scalex = False )
3660
+ new_default_lims = (self .yaxis .get_major_locator ()
3661
+ .nonsingular (- np .inf , np .inf ))
3662
+ if old_default_lims != new_default_lims :
3663
+ # Force autoscaling now, to take advantage of the scale locator's
3664
+ # nonsingular() before it possibly gets swapped out by the user.
3665
+ self .autoscale_view (scalex = False )
3654
3666
3655
3667
@cbook ._make_keyword_only ("3.2" , "minor" )
3656
3668
def get_yticks (self , minor = False ):
0 commit comments