@@ -2409,17 +2409,9 @@ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
2409
2409
dl .extend (y_finite )
2410
2410
2411
2411
bb = mtransforms .BboxBase .union (dl )
2412
- # fall back on the viewlimits if this is not finite:
2413
- vl = None
2414
- if not np .isfinite (bb .intervalx ).all ():
2415
- vl = mtransforms .BboxBase .union ([ax .viewLim for ax in shared ])
2416
- bb .intervalx = vl .intervalx
2417
- if not np .isfinite (bb .intervaly ).all ():
2418
- if vl is None :
2419
- vl = mtransforms .BboxBase .union (
2420
- [ax .viewLim for ax in shared ])
2421
- bb .intervaly = vl .intervaly
2422
2412
x0 , x1 = getattr (bb , interval )
2413
+ # If x0 and x1 are non finite, use the locator to figure out
2414
+ # default limits.
2423
2415
locator = axis .get_major_locator ()
2424
2416
x0 , x1 = locator .nonsingular (x0 , x1 )
2425
2417
@@ -3260,20 +3252,26 @@ def set_xscale(self, value, **kwargs):
3260
3252
- `matplotlib.scale.SymmetricalLogScale`
3261
3253
- `matplotlib.scale.LogitScale`
3262
3254
3263
-
3264
3255
Notes
3265
3256
-----
3266
3257
By default, Matplotlib supports the above mentioned scales.
3267
3258
Additionally, custom scales may be registered using
3268
3259
`matplotlib.scale.register_scale`. These scales can then also
3269
3260
be used here.
3270
3261
"""
3262
+ old_default_lims = (self .xaxis .get_major_locator ()
3263
+ .nonsingular (- np .inf , np .inf ))
3271
3264
g = self .get_shared_x_axes ()
3272
3265
for ax in g .get_siblings (self ):
3273
3266
ax .xaxis ._set_scale (value , ** kwargs )
3274
3267
ax ._update_transScale ()
3275
3268
ax .stale = True
3276
- 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 )
3277
3275
3278
3276
@cbook ._make_keyword_only ("3.2" , "minor" )
3279
3277
def get_xticks (self , minor = False ):
@@ -3645,20 +3643,26 @@ def set_yscale(self, value, **kwargs):
3645
3643
- `matplotlib.scale.SymmetricalLogScale`
3646
3644
- `matplotlib.scale.LogitScale`
3647
3645
3648
-
3649
3646
Notes
3650
3647
-----
3651
3648
By default, Matplotlib supports the above mentioned scales.
3652
3649
Additionally, custom scales may be registered using
3653
3650
`matplotlib.scale.register_scale`. These scales can then also
3654
3651
be used here.
3655
3652
"""
3653
+ old_default_lims = (self .yaxis .get_major_locator ()
3654
+ .nonsingular (- np .inf , np .inf ))
3656
3655
g = self .get_shared_y_axes ()
3657
3656
for ax in g .get_siblings (self ):
3658
3657
ax .yaxis ._set_scale (value , ** kwargs )
3659
3658
ax ._update_transScale ()
3660
3659
ax .stale = True
3661
- 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 )
3662
3666
3663
3667
@cbook ._make_keyword_only ("3.2" , "minor" )
3664
3668
def get_yticks (self , minor = False ):
0 commit comments