@@ -2987,9 +2987,16 @@ def xaxis_inverted(self):
2987
2987
left , right = self .get_xlim ()
2988
2988
return right < left
2989
2989
2990
- def get_xbound (self ):
2991
- """Return the lower and upper x-axis bounds, in increasing order."""
2992
- left , right = self .get_xlim ()
2990
+ def get_xbound (self , units = True ):
2991
+ """
2992
+ Return the lower and upper x-axis bounds, in increasing order.
2993
+
2994
+ Parameters
2995
+ ----------
2996
+ units : bool, optional
2997
+ If *True*, return bounds with units attached.
2998
+ """
2999
+ left , right = self .get_xlim (units )
2993
3000
if left < right :
2994
3001
return left , right
2995
3002
else :
@@ -3025,10 +3032,15 @@ def set_xbound(self, lower=None, upper=None):
3025
3032
else :
3026
3033
self .set_xlim (upper , lower , auto = None )
3027
3034
3028
- def get_xlim (self ):
3035
+ def get_xlim (self , units = True ):
3029
3036
"""
3030
3037
Get the x-axis range
3031
3038
3039
+ Parameters
3040
+ ----------
3041
+ units : bool, optional
3042
+ If *True*, return limits with units attached.
3043
+
3032
3044
Returns
3033
3045
-------
3034
3046
xlimits : tuple
@@ -3041,7 +3053,10 @@ def get_xlim(self):
3041
3053
be greater than the `right` value.
3042
3054
3043
3055
"""
3044
- return self ._convert_back_lim (self .viewLim .intervalx , self .xaxis )
3056
+ if units :
3057
+ return self ._convert_back_lim (self .viewLim .intervalx , self .xaxis )
3058
+ else :
3059
+ return tuple (self .viewLim .intervalx )
3045
3060
3046
3061
def _convert_back_lim (self , lim , axis ):
3047
3062
"""
@@ -3349,9 +3364,16 @@ def yaxis_inverted(self):
3349
3364
bottom , top = self .get_ylim ()
3350
3365
return top < bottom
3351
3366
3352
- def get_ybound (self ):
3353
- """Return the lower and upper y-axis bounds, in increasing order."""
3354
- bottom , top = self .get_ylim ()
3367
+ def get_ybound (self , units = True ):
3368
+ """
3369
+ Return the lower and upper y-axis bounds, in increasing order.
3370
+
3371
+ Parameters
3372
+ ----------
3373
+ units : bool, optional
3374
+ If *True*, return bounds with units attached.
3375
+ """
3376
+ bottom , top = self .get_ylim (units )
3355
3377
if bottom < top :
3356
3378
return bottom , top
3357
3379
else :
@@ -3386,10 +3408,15 @@ def set_ybound(self, lower=None, upper=None):
3386
3408
else :
3387
3409
self .set_ylim (upper , lower , auto = None )
3388
3410
3389
- def get_ylim (self ):
3411
+ def get_ylim (self , units = True ):
3390
3412
"""
3391
3413
Get the y-axis range
3392
3414
3415
+ Parameters
3416
+ ----------
3417
+ units : bool, optional
3418
+ If *True*, return bounds with units attached.
3419
+
3393
3420
Returns
3394
3421
-------
3395
3422
ylimits : tuple
@@ -3402,8 +3429,10 @@ def get_ylim(self):
3402
3429
will be greater than the `top` value.
3403
3430
3404
3431
"""
3405
- return self ._convert_back_lim (self .viewLim .intervaly , self .yaxis )
3406
- return tuple (self .viewLim .intervaly )
3432
+ if units :
3433
+ return self ._convert_back_lim (self .viewLim .intervaly , self .yaxis )
3434
+ else :
3435
+ return tuple (self .viewLim .intervaly )
3407
3436
3408
3437
def set_ylim (self , bottom = None , top = None , emit = True , auto = False ,
3409
3438
* , ymin = None , ymax = None ):
0 commit comments