Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b675af

Browse filesBrowse files
committed
Assign event to later Axes if zorders are tied.
If axes zorders are tied, axes appearing later in figure.axes get drawn above those appearing earlier, so events should be preferably assigned to them. By default, max() returns the *first* maximum in case of ties, so the previous implementation was not satisfactory.
1 parent b4b4794 commit 1b675af
Copy full SHA for 1b675af

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,8 +1527,11 @@ def __init__(self, name, canvas, x, y, guiEvent=None):
15271527
else:
15281528
axes_list = [self.canvas.mouse_grabber]
15291529

1530-
if axes_list: # Use highest zorder.
1531-
self.inaxes = max(axes_list, key=lambda x: x.zorder)
1530+
if axes_list:
1531+
# Use highest zorder; use later Axes in case of a tie as they are
1532+
# drawn later (thus, above).
1533+
_, _, self.inaxes = max((ax.zorder, idx, ax)
1534+
for idx, ax in enumerate(axes_list))
15321535
else: # None found.
15331536
self.inaxes = None
15341537
self._update_enter_leave()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.