@@ -3028,7 +3028,8 @@ def _validate_converted_limits(self, limit, convert):
3028
3028
raise ValueError ("Axis limits cannot be NaN or Inf" )
3029
3029
return converted_limit
3030
3030
3031
- def set_xlim (self , left = None , right = None , emit = True , auto = False , ** kw ):
3031
+ def set_xlim (self , left = None , right = None , emit = True , auto = False ,
3032
+ * , xmin = None , xmax = None ):
3032
3033
"""
3033
3034
Set the data limits for the x-axis
3034
3035
@@ -3039,6 +3040,9 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3039
3040
left : scalar, optional
3040
3041
The left xlim (default: None, which leaves the left limit
3041
3042
unchanged).
3043
+ The left and right xlims may be passed as the tuple
3044
+ (`left`, `right`) as the first positional argument (or as
3045
+ the `left` keyword argument).
3042
3046
3043
3047
right : scalar, optional
3044
3048
The right xlim (default: None, which leaves the right limit
@@ -3051,10 +3055,11 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3051
3055
Whether to turn on autoscaling of the x-axis. True turns on,
3052
3056
False turns off (default action), None leaves unchanged.
3053
3057
3054
- xlimits : tuple, optional
3055
- The left and right xlims may be passed as the tuple
3056
- (`left`, `right`) as the first positional argument (or as
3057
- the `left` keyword argument).
3058
+ xmin, xmax : scalar, optional
3059
+ These arguments are deprecated and will be removed in a future
3060
+ version. They are equivalent to left and right respectively,
3061
+ and it is an error to pass both `xmin` and `left` or
3062
+ `xmax` and `right`.
3058
3063
3059
3064
Returns
3060
3065
-------
@@ -3085,15 +3090,20 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3085
3090
>>> set_xlim(5000, 0)
3086
3091
3087
3092
"""
3088
- if 'xmin' in kw :
3089
- left = kw .pop ('xmin' )
3090
- if 'xmax' in kw :
3091
- right = kw .pop ('xmax' )
3092
- if kw :
3093
- raise ValueError ("unrecognized kwargs: %s" % list (kw ))
3094
-
3095
3093
if right is None and iterable (left ):
3096
3094
left , right = left
3095
+ if xmin is not None :
3096
+ cbook .warn_deprecated ('3.0' , name = '`xmin`' ,
3097
+ alternative = '`left`' , obj_type = 'argument' )
3098
+ if left is not None :
3099
+ raise TypeError ('Cannot pass both `xmin` and `left`' )
3100
+ left = xmin
3101
+ if xmax is not None :
3102
+ cbook .warn_deprecated ('3.0' , name = '`xmax`' ,
3103
+ alternative = '`right`' , obj_type = 'argument' )
3104
+ if right is not None :
3105
+ raise TypeError ('Cannot pass both `xmax` and `right`' )
3106
+ right = xmax
3097
3107
3098
3108
self ._process_unit_info (xdata = (left , right ))
3099
3109
left = self ._validate_converted_limits (left , self .convert_xunits )
@@ -3358,7 +3368,8 @@ def get_ylim(self):
3358
3368
"""
3359
3369
return tuple (self .viewLim .intervaly )
3360
3370
3361
- def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
3371
+ def set_ylim (self , bottom = None , top = None , emit = True , auto = False ,
3372
+ * , ymin = None , ymax = None ):
3362
3373
"""
3363
3374
Set the data limits for the y-axis
3364
3375
@@ -3369,6 +3380,9 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3369
3380
bottom : scalar, optional
3370
3381
The bottom ylim (default: None, which leaves the bottom
3371
3382
limit unchanged).
3383
+ The bottom and top ylims may be passed as the tuple
3384
+ (`bottom`, `top`) as the first positional argument (or as
3385
+ the `bottom` keyword argument).
3372
3386
3373
3387
top : scalar, optional
3374
3388
The top ylim (default: None, which leaves the top limit
@@ -3381,10 +3395,11 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3381
3395
Whether to turn on autoscaling of the y-axis. True turns on,
3382
3396
False turns off (default action), None leaves unchanged.
3383
3397
3384
- ylimits : tuple, optional
3385
- The bottom and top yxlims may be passed as the tuple
3386
- (`bottom`, `top`) as the first positional argument (or as
3387
- the `bottom` keyword argument).
3398
+ ymin, ymax : scalar, optional
3399
+ These arguments are deprecated and will be removed in a future
3400
+ version. They are equivalent to bottom and top respectively,
3401
+ and it is an error to pass both `xmin` and `bottom` or
3402
+ `xmax` and `top`.
3388
3403
3389
3404
Returns
3390
3405
-------
@@ -3414,15 +3429,20 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3414
3429
3415
3430
>>> set_ylim(5000, 0)
3416
3431
"""
3417
- if 'ymin' in kw :
3418
- bottom = kw .pop ('ymin' )
3419
- if 'ymax' in kw :
3420
- top = kw .pop ('ymax' )
3421
- if kw :
3422
- raise ValueError ("unrecognized kwargs: %s" % list (kw ))
3423
-
3424
3432
if top is None and iterable (bottom ):
3425
3433
bottom , top = bottom
3434
+ if ymin is not None :
3435
+ cbook .warn_deprecated ('3.0' , name = '`ymin`' ,
3436
+ alternative = '`bottom`' , obj_type = 'argument' )
3437
+ if bottom is not None :
3438
+ raise TypeError ('Cannot pass both `ymin` and `bottom`' )
3439
+ bottom = ymin
3440
+ if ymax is not None :
3441
+ cbook .warn_deprecated ('3.0' , name = '`ymax`' ,
3442
+ alternative = '`top`' , obj_type = 'argument' )
3443
+ if top is not None :
3444
+ raise TypeError ('Cannot pass both `ymax` and `top`' )
3445
+ top = ymax
3426
3446
3427
3447
bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
3428
3448
top = self ._validate_converted_limits (top , self .convert_yunits )
0 commit comments