@@ -3264,11 +3264,10 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False,
3264
3264
cbook ._warn_external (
3265
3265
f"Attempting to set identical left == right == { left } results "
3266
3266
f"in singular transformations; automatically expanding." )
3267
- swapped = left > right
3267
+ reverse = left > right
3268
3268
left , right = self .xaxis .get_major_locator ().nonsingular (left , right )
3269
3269
left , right = self .xaxis .limit_range_for_scale (left , right )
3270
- if swapped :
3271
- left , right = right , left
3270
+ left , right = sorted ([left , right ], reverse = reverse )
3272
3271
3273
3272
self .viewLim .intervalx = (left , right )
3274
3273
if auto is not None :
@@ -3647,11 +3646,10 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
3647
3646
f"Attempting to set identical bottom == top == { bottom } "
3648
3647
f"results in singular transformations; automatically "
3649
3648
f"expanding." )
3650
- swapped = bottom > top
3649
+ reverse = bottom > top
3651
3650
bottom , top = self .yaxis .get_major_locator ().nonsingular (bottom , top )
3652
3651
bottom , top = self .yaxis .limit_range_for_scale (bottom , top )
3653
- if swapped :
3654
- bottom , top = top , bottom
3652
+ bottom , top = sorted ([bottom , top ], reverse = reverse )
3655
3653
3656
3654
self .viewLim .intervaly = (bottom , top )
3657
3655
if auto is not None :
0 commit comments