@@ -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,8 @@ 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
+ ymin, ymax : scalar, optional
3047
+ If passed, these arguments override bottom and top respectively.
3046
3048
3047
3049
Returns
3048
3050
-------
@@ -3073,15 +3075,16 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
3073
3075
>>> set_xlim(5000, 0)
3074
3076
3075
3077
"""
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
3078
if right is None and iterable (left ):
3084
3079
left , right = left
3080
+ if xmin is not None :
3081
+ if left is not None :
3082
+ warnings .warn ('xmin=%r overrides left=%r' % (xmin , left ))
3083
+ left = xmin
3084
+ if xmax is not None :
3085
+ if right is not None :
3086
+ warnings .warn ('xmax=%r overrides right=%r' % (xmax , right ))
3087
+ right = xmax
3085
3088
3086
3089
self ._process_unit_info (xdata = (left , right ))
3087
3090
left = self ._validate_converted_limits (left , self .convert_xunits )
@@ -3346,7 +3349,8 @@ def get_ylim(self):
3346
3349
"""
3347
3350
return tuple (self .viewLim .intervaly )
3348
3351
3349
- def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
3352
+ def set_ylim (self , bottom = None , top = None , emit = True , auto = False ,
3353
+ * , ymin = None , ymax = None ):
3350
3354
"""
3351
3355
Set the data limits for the y-axis
3352
3356
@@ -3357,6 +3361,9 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3357
3361
bottom : scalar, optional
3358
3362
The bottom ylim (default: None, which leaves the bottom
3359
3363
limit unchanged).
3364
+ The bottom and top yxlims may be passed as the tuple
3365
+ (`bottom`, `top`) as the first positional argument (or as
3366
+ the `bottom` keyword argument).
3360
3367
3361
3368
top : scalar, optional
3362
3369
The top ylim (default: None, which leaves the top limit
@@ -3369,10 +3376,8 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3369
3376
Whether to turn on autoscaling of the y-axis. True turns on,
3370
3377
False turns off (default action), None leaves unchanged.
3371
3378
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).
3379
+ ymin, ymax : scalar, optional
3380
+ If passed, these arguments override bottom and top respectively.
3376
3381
3377
3382
Returns
3378
3383
-------
@@ -3402,15 +3407,16 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3402
3407
3403
3408
>>> set_ylim(5000, 0)
3404
3409
"""
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
3410
if top is None and iterable (bottom ):
3413
3411
bottom , top = bottom
3412
+ if ymin is not None :
3413
+ if bottom is not None :
3414
+ warnings .warn ('ymin=%r overrides bottom=%r' % (ymin , bottom ))
3415
+ bottom = ymin
3416
+ if ymax is not None :
3417
+ if top is not None :
3418
+ warnings .warn ('ymax=%r overrides top=%r' % (ymax , top ))
3419
+ top = ymax
3414
3420
3415
3421
bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
3416
3422
top = self ._validate_converted_limits (top , self .convert_yunits )
0 commit comments