@@ -3264,11 +3264,10 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False,
32643264 cbook ._warn_external (
32653265 f"Attempting to set identical left == right == { left } results "
32663266 f"in singular transformations; automatically expanding." )
3267- swapped = left > right
3267+ reverse = left > right
32683268 left , right = self .xaxis .get_major_locator ().nonsingular (left , right )
32693269 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 )
32723271
32733272 self .viewLim .intervalx = (left , right )
32743273 if auto is not None :
@@ -3647,11 +3646,10 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
36473646 f"Attempting to set identical bottom == top == { bottom } "
36483647 f"results in singular transformations; automatically "
36493648 f"expanding." )
3650- swapped = bottom > top
3649+ reverse = bottom > top
36513650 bottom , top = self .yaxis .get_major_locator ().nonsingular (bottom , top )
36523651 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 )
36553653
36563654 self .viewLim .intervaly = (bottom , top )
36573655 if auto is not None :
0 commit comments