@@ -2996,9 +2996,16 @@ def xaxis_inverted(self):
2996
2996
left , right = self .get_xlim ()
2997
2997
return right < left
2998
2998
2999
- def get_xbound (self ):
3000
- """Return the lower and upper x-axis bounds, in increasing order."""
3001
- left , right = self .get_xlim ()
2999
+ def get_xbound (self , units = True ):
3000
+ """
3001
+ Return the lower and upper x-axis bounds, in increasing order.
3002
+
3003
+ Parameters
3004
+ ----------
3005
+ units : bool, optional
3006
+ If *True*, return bounds with units attached.
3007
+ """
3008
+ left , right = self .get_xlim (units )
3002
3009
if left < right :
3003
3010
return left , right
3004
3011
else :
@@ -3034,10 +3041,15 @@ def set_xbound(self, lower=None, upper=None):
3034
3041
else :
3035
3042
self .set_xlim (upper , lower , auto = None )
3036
3043
3037
- def get_xlim (self ):
3044
+ def get_xlim (self , units = True ):
3038
3045
"""
3039
3046
Get the x-axis range
3040
3047
3048
+ Parameters
3049
+ ----------
3050
+ units : bool, optional
3051
+ If *True*, return limits with units attached.
3052
+
3041
3053
Returns
3042
3054
-------
3043
3055
xlimits : tuple
@@ -3050,7 +3062,10 @@ def get_xlim(self):
3050
3062
be greater than the `right` value.
3051
3063
3052
3064
"""
3053
- return self ._convert_back_lim (self .viewLim .intervalx , self .xaxis )
3065
+ if units :
3066
+ return self ._convert_back_lim (self .viewLim .intervalx , self .xaxis )
3067
+ else :
3068
+ return tuple (self .viewLim .intervalx )
3054
3069
3055
3070
def _convert_back_lim (self , lim , axis ):
3056
3071
"""
@@ -3358,9 +3373,16 @@ def yaxis_inverted(self):
3358
3373
bottom , top = self .get_ylim ()
3359
3374
return top < bottom
3360
3375
3361
- def get_ybound (self ):
3362
- """Return the lower and upper y-axis bounds, in increasing order."""
3363
- bottom , top = self .get_ylim ()
3376
+ def get_ybound (self , units = True ):
3377
+ """
3378
+ Return the lower and upper y-axis bounds, in increasing order.
3379
+
3380
+ Parameters
3381
+ ----------
3382
+ units : bool, optional
3383
+ If *True*, return bounds with units attached.
3384
+ """
3385
+ bottom , top = self .get_ylim (units )
3364
3386
if bottom < top :
3365
3387
return bottom , top
3366
3388
else :
@@ -3395,10 +3417,15 @@ def set_ybound(self, lower=None, upper=None):
3395
3417
else :
3396
3418
self .set_ylim (upper , lower , auto = None )
3397
3419
3398
- def get_ylim (self ):
3420
+ def get_ylim (self , units = True ):
3399
3421
"""
3400
3422
Get the y-axis range
3401
3423
3424
+ Parameters
3425
+ ----------
3426
+ units : bool, optional
3427
+ If *True*, return bounds with units attached.
3428
+
3402
3429
Returns
3403
3430
-------
3404
3431
ylimits : tuple
@@ -3411,8 +3438,10 @@ def get_ylim(self):
3411
3438
will be greater than the `top` value.
3412
3439
3413
3440
"""
3414
- return self ._convert_back_lim (self .viewLim .intervaly , self .yaxis )
3415
- return tuple (self .viewLim .intervaly )
3441
+ if units :
3442
+ return self ._convert_back_lim (self .viewLim .intervaly , self .yaxis )
3443
+ else :
3444
+ return tuple (self .viewLim .intervaly )
3416
3445
3417
3446
def set_ylim (self , bottom = None , top = None , emit = True , auto = False ,
3418
3447
* , ymin = None , ymax = None ):
0 commit comments