There was an error while loading. Please reload this page.
1 parent ced2f13 commit 4a25184Copy full SHA for 4a25184
1 file changed
lib/matplotlib/widgets.py
@@ -3660,12 +3660,23 @@ def _clip_to_axes(self, x, y):
3660
3661
min_lim = (xlim[0], ylim[0])
3662
max_lim = (xlim[1], ylim[1])
3663
+
3664
# Axes limits in display coordinates
3665
min_lim = self.ax.transData.transform(min_lim)
3666
max_lim = self.ax.transData.transform(max_lim)
3667
3668
+ # For axes where the limits are reversed, need to make sure the
3669
+ # display min/max are in the correct order.
3670
3671
+ if min_lim[0] > max_lim[0]:
3672
+ min_lim[0], max_lim[0] = max_lim[0], min_lim[0]
3673
3674
+ if min_lim[1] > max_lim[1]:
3675
+ min_lim[1], max_lim[1] = max_lim[1], min_lim[1]
3676
3677
x = np.clip(x, min_lim[0], max_lim[0])
3678
y = np.clip(y, min_lim[1], max_lim[1])
3679
3680
return x, y
3681
3682
# TODO: _draw_shape can be removed in 3.7
0 commit comments