Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 853312b

Browse files
authored
Merge pull request matplotlib#22857 from anntzer/tztw
Slightly simplify twin axes detection in MEP22 zoom.
2 parents 16f6370 + 339c630 commit 853312b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/matplotlib/backend_tools.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ def _release(self, event):
821821
self._cancel_action()
822822
return
823823

824-
last_a = []
824+
done_ax = []
825825

826826
for cur_xypress in self._xypress:
827827
x, y = event.x, event.y
@@ -832,14 +832,9 @@ def _release(self, event):
832832
return
833833

834834
# detect twinx, twiny axes and avoid double zooming
835-
twinx, twiny = False, False
836-
if last_a:
837-
for la in last_a:
838-
if a.get_shared_x_axes().joined(a, la):
839-
twinx = True
840-
if a.get_shared_y_axes().joined(a, la):
841-
twiny = True
842-
last_a.append(a)
835+
twinx = any(a.get_shared_x_axes().joined(a, a1) for a1 in done_ax)
836+
twiny = any(a.get_shared_y_axes().joined(a, a1) for a1 in done_ax)
837+
done_ax.append(a)
843838

844839
if self._button_pressed == 1:
845840
direction = 'in'

0 commit comments

Comments
 (0)