@@ -3028,7 +3028,8 @@ def _validate_converted_limits(self, limit, convert):
30283028 raise ValueError ("Axis limits cannot be NaN or Inf" )
30293029 return converted_limit
30303030
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 ):
30323033 """
30333034 Set the data limits for the x-axis
30343035
@@ -3039,6 +3040,9 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
30393040 left : scalar, optional
30403041 The left xlim (default: None, which leaves the left limit
30413042 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).
30423046
30433047 right : scalar, optional
30443048 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):
30513055 Whether to turn on autoscaling of the x-axis. True turns on,
30523056 False turns off (default action), None leaves unchanged.
30533057
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`.
30583063
30593064 Returns
30603065 -------
@@ -3085,15 +3090,20 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
30853090 >>> set_xlim(5000, 0)
30863091
30873092 """
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-
30953093 if right is None and iterable (left ):
30963094 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
30973107
30983108 self ._process_unit_info (xdata = (left , right ))
30993109 left = self ._validate_converted_limits (left , self .convert_xunits )
@@ -3358,7 +3368,8 @@ def get_ylim(self):
33583368 """
33593369 return tuple (self .viewLim .intervaly )
33603370
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 ):
33623373 """
33633374 Set the data limits for the y-axis
33643375
@@ -3369,6 +3380,9 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
33693380 bottom : scalar, optional
33703381 The bottom ylim (default: None, which leaves the bottom
33713382 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).
33723386
33733387 top : scalar, optional
33743388 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):
33813395 Whether to turn on autoscaling of the y-axis. True turns on,
33823396 False turns off (default action), None leaves unchanged.
33833397
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`.
33883403
33893404 Returns
33903405 -------
@@ -3414,15 +3429,20 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
34143429
34153430 >>> set_ylim(5000, 0)
34163431 """
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-
34243432 if top is None and iterable (bottom ):
34253433 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
34263446
34273447 bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
34283448 top = self ._validate_converted_limits (top , self .convert_yunits )
0 commit comments