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 ee857f5

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 ee857f5
Copy full SHA for ee857f5

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,10 @@ def __init__(self, name, canvas, x, y, guiEvent=None):
15281528
axes_list = [self.canvas.mouse_grabber]
15291529

15301530
if axes_list: # Use highest zorder.
1531-
self.inaxes = max(axes_list, key=lambda x: x.zorder)
1531+
# Use highest zorder; use later axis 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.