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 f52af63

Browse filesBrowse files
committed
Merge pull request #7102 from fariza/artist-value-tool-message
ENH: Adding the artist data on mouse move event message
1 parent 9fad924 commit f52af63
Copy full SHA for f52af63

File tree

Expand file treeCollapse file tree

2 files changed

+12
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-3
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,11 +2847,10 @@ def mouse_move(self, event):
28472847
pass
28482848
else:
28492849
artists = [a for a in event.inaxes.mouseover_set
2850-
if a.contains(event)]
2850+
if a.contains(event) and a.get_visible()]
28512851

28522852
if artists:
2853-
2854-
a = max(enumerate(artists), key=lambda x: x[1].zorder)[1]
2853+
a = max(artists, key=lambda x: x.zorder)
28552854
if a is not event.inaxes.patch:
28562855
data = a.get_cursor_data(event)
28572856
if data is not None:

‎lib/matplotlib/backend_tools.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_tools.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ def send_message(self, event):
283283
except (ValueError, OverflowError):
284284
pass
285285
else:
286+
artists = [a for a in event.inaxes.mouseover_set
287+
if a.contains(event) and a.get_visible()]
288+
289+
if artists:
290+
a = max(artists, key=lambda x: x.zorder)
291+
if a is not event.inaxes.patch:
292+
data = a.get_cursor_data(event)
293+
if data is not None:
294+
s += ' [%s]' % a.format_cursor_data(data)
295+
286296
message = s
287297
self.toolmanager.message_event(message, self)
288298

0 commit comments

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