@@ -3016,7 +3016,8 @@ def _validate_converted_limits(self, limit, convert):
3016
3016
raise ValueError ("Axis limits cannot be NaN or Inf" )
3017
3017
return converted_limit
3018
3018
3019
- def set_xlim (self , left = None , right = None , emit = True , auto = False , ** kw ):
3019
+ def set_xlim (self , left = None , right = None , emit = True , auto = False ,
3020
+ * , xmin = None , xmax = None ):
3020
3021
"""
3021
3022
Set the data limits for the x-axis
3022
3023
@@ -3027,6 +3028,9 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3027
3028
left : scalar, optional
3028
3029
The left xlim (default: None, which leaves the left limit
3029
3030
unchanged).
3031
+ The left and right xlims may be passed as the tuple
3032
+ (`left`, `right`) as the first positional argument (or as
3033
+ the `left` keyword argument).
3030
3034
3031
3035
right : scalar, optional
3032
3036
The right xlim (default: None, which leaves the right limit
@@ -3039,10 +3043,11 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3039
3043
Whether to turn on autoscaling of the x-axis. True turns on,
3040
3044
False turns off (default action), None leaves unchanged.
3041
3045
3042
- xlimits : tuple, optional
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).
3046
+ xmin, xmax : scalar, optional
3047
+ These arguments are deprecated and will be removed in a future
3048
+ version. They are equivalent to left and right respectively,
3049
+ and it is an error to pass both `xmin` and `left` or
3050
+ `xmax` and `right`.
3046
3051
3047
3052
Returns
3048
3053
-------
@@ -3073,15 +3078,20 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3073
3078
>>> set_xlim(5000, 0)
3074
3079
3075
3080
"""
3076
- if 'xmin' in kw :
3077
- left = kw .pop ('xmin' )
3078
- if 'xmax' in kw :
3079
- right = kw .pop ('xmax' )
3080
- if kw :
3081
- raise ValueError ("unrecognized kwargs: %s" % list (kw ))
3082
-
3083
3081
if right is None and iterable (left ):
3084
3082
left , right = left
3083
+ if xmin is not None :
3084
+ cbook .warn_deprecated ('3.0' , name = '`xmin`' ,
3085
+ alternative = '`left`' , obj_type = 'argument' )
3086
+ if left is not None :
3087
+ raise TypeError ('Cannot pass both `xmin` and `left`' )
3088
+ left = xmin
3089
+ if xmax is not None :
3090
+ cbook .warn_deprecated ('3.0' , name = '`xmax`' ,
3091
+ alternative = '`right`' , obj_type = 'argument' )
3092
+ if right is not None :
3093
+ raise TypeError ('Cannot pass both `xmax` and `right`' )
3094
+ right = xmax
3085
3095
3086
3096
self ._process_unit_info (xdata = (left , right ))
3087
3097
left = self ._validate_converted_limits (left , self .convert_xunits )
@@ -3346,7 +3356,8 @@ def get_ylim(self):
3346
3356
"""
3347
3357
return tuple (self .viewLim .intervaly )
3348
3358
3349
- def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
3359
+ def set_ylim (self , bottom = None , top = None , emit = True , auto = False ,
3360
+ * , ymin = None , ymax = None ):
3350
3361
"""
3351
3362
Set the data limits for the y-axis
3352
3363
@@ -3357,6 +3368,9 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3357
3368
bottom : scalar, optional
3358
3369
The bottom ylim (default: None, which leaves the bottom
3359
3370
limit unchanged).
3371
+ The bottom and top ylims may be passed as the tuple
3372
+ (`bottom`, `top`) as the first positional argument (or as
3373
+ the `bottom` keyword argument).
3360
3374
3361
3375
top : scalar, optional
3362
3376
The top ylim (default: None, which leaves the top limit
@@ -3369,10 +3383,11 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3369
3383
Whether to turn on autoscaling of the y-axis. True turns on,
3370
3384
False turns off (default action), None leaves unchanged.
3371
3385
3372
- ylimits : tuple, optional
3373
- The bottom and top yxlims may be passed as the tuple
3374
- (`bottom`, `top`) as the first positional argument (or as
3375
- the `bottom` keyword argument).
3386
+ ymin, ymax : scalar, optional
3387
+ These arguments are deprecated and will be removed in a future
3388
+ version. They are equivalent to bottom and top respectively,
3389
+ and it is an error to pass both `xmin` and `bottom` or
3390
+ `xmax` and `top`.
3376
3391
3377
3392
Returns
3378
3393
-------
@@ -3402,15 +3417,20 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3402
3417
3403
3418
>>> set_ylim(5000, 0)
3404
3419
"""
3405
- if 'ymin' in kw :
3406
- bottom = kw .pop ('ymin' )
3407
- if 'ymax' in kw :
3408
- top = kw .pop ('ymax' )
3409
- if kw :
3410
- raise ValueError ("unrecognized kwargs: %s" % list (kw ))
3411
-
3412
3420
if top is None and iterable (bottom ):
3413
3421
bottom , top = bottom
3422
+ if ymin is not None :
3423
+ cbook .warn_deprecated ('3.0' , name = '`ymin`' ,
3424
+ alternative = '`bottom`' , obj_type = 'argument' )
3425
+ if bottom is not None :
3426
+ raise TypeError ('Cannot pass both `ymin` and `bottom`' )
3427
+ bottom = ymin
3428
+ if ymax is not None :
3429
+ cbook .warn_deprecated ('3.0' , name = '`ymax`' ,
3430
+ alternative = '`top`' , obj_type = 'argument' )
3431
+ if top is not None :
3432
+ raise TypeError ('Cannot pass both `ymax` and `top`' )
3433
+ top = ymax
3414
3434
3415
3435
bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
3416
3436
top = self ._validate_converted_limits (top , self .convert_yunits )
0 commit comments