77from six .moves import xrange
88
99import itertools
10- import warnings
10+ import logging
1111import math
1212from operator import attrgetter
13+ import warnings
1314
1415import numpy as np
1516
3839from matplotlib .rcsetup import cycler
3940from matplotlib .rcsetup import validate_axisbelow
4041
42+ _log = logging .getLogger (__name__ )
43+
4144rcParams = matplotlib .rcParams
4245
4346is_string_like = cbook .is_string_like
@@ -1002,7 +1005,7 @@ def cla(self):
10021005 else :
10031006 self .xaxis ._set_scale ('linear' )
10041007 try :
1005- self .set_xlim (0 , 1 )
1008+ self .set_xlim (0 , 1 , _converter = False )
10061009 except TypeError :
10071010 pass
10081011
@@ -1016,7 +1019,7 @@ def cla(self):
10161019 else :
10171020 self .yaxis ._set_scale ('linear' )
10181021 try :
1019- self .set_ylim (0 , 1 )
1022+ self .set_ylim (0 , 1 , _converter = False )
10201023 except TypeError :
10211024 pass
10221025
@@ -2377,6 +2380,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
23772380 case, use :meth:`matplotlib.axes.Axes.relim` prior to calling
23782381 autoscale_view.
23792382 """
2383+ _log .debug ('Autoscaling x: %s y: %s' , scalex , scaley )
23802384 if tight is not None :
23812385 self ._tight = bool (tight )
23822386
@@ -2446,6 +2450,7 @@ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
24462450
24472451 if not self ._tight :
24482452 x0 , x1 = locator .view_limits (x0 , x1 )
2453+ _log .debug ('Autolims: %e %e' , x0 , x1 )
24492454 set_bound (x0 , x1 )
24502455 # End of definition of internal function 'handle_single_axis'.
24512456
@@ -2923,6 +2928,7 @@ def set_xbound(self, lower=None, upper=None):
29232928 self .set_xlim (upper , lower , auto = None )
29242929 else :
29252930 self .set_xlim (lower , upper , auto = None )
2931+ self .set_xlim (lower , upper , auto = None )
29262932 else :
29272933 if lower < upper :
29282934 self .set_xlim (lower , upper , auto = None )
@@ -3028,15 +3034,19 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
30283034 left = kw .pop ('xmin' )
30293035 if 'xmax' in kw :
30303036 right = kw .pop ('xmax' )
3037+ # _converter is private, usually True, but can be false
3038+ _converter = kw .pop ('_converter' , True )
30313039 if kw :
30323040 raise ValueError ("unrecognized kwargs: %s" % list (kw ))
30333041
30343042 if right is None and iterable (left ):
30353043 left , right = left
30363044
3037- self ._process_unit_info (xdata = (left , right ))
3038- left = self ._validate_converted_limits (left , self .convert_xunits )
3039- right = self ._validate_converted_limits (right , self .convert_xunits )
3045+ if _converter :
3046+ _log .debug ('Converting xlim %s %s' , left , right )
3047+ self ._process_unit_info (xdata = (left , right ))
3048+ left = self ._validate_converted_limits (left , self .convert_xunits )
3049+ right = self ._validate_converted_limits (right , self .convert_xunits )
30403050
30413051 old_left , old_right = self .get_xlim ()
30423052 if left is None :
@@ -3352,14 +3362,20 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
33523362 bottom = kw .pop ('ymin' )
33533363 if 'ymax' in kw :
33543364 top = kw .pop ('ymax' )
3365+ _converter = kw .pop ('_converter' , True )
33553366 if kw :
33563367 raise ValueError ("unrecognized kwargs: %s" % list (kw ))
33573368
33583369 if top is None and iterable (bottom ):
33593370 bottom , top = bottom
33603371
3361- bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
3362- top = self ._validate_converted_limits (top , self .convert_yunits )
3372+ if _converter :
3373+ _log .debug ('Converting ylim %s %s' , bottom , top )
3374+ self ._process_unit_info (ydata = (bottom , top ))
3375+ bottom = self ._validate_converted_limits (bottom ,
3376+ self .convert_yunits )
3377+ top = self ._validate_converted_limits (top ,
3378+ self .convert_yunits )
33633379
33643380 old_bottom , old_top = self .get_ylim ()
33653381
0 commit comments