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

Adding the artist data on mouse move event message #7102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding the artist data on mouse move event message
  • Loading branch information
Federico Ariza committed Sep 13, 2016
commit 3205e6abb3183a21afe55097c40ae75f420de5f0
2 changes: 1 addition & 1 deletion 2 lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2881,7 +2881,7 @@ def mouse_move(self, event):
pass
else:
artists = [a for a in event.inaxes.mouseover_set
if a.contains(event)]
if a.contains(event) and a.get_visible()]

if artists:

Expand Down
10 changes: 10 additions & 0 deletions 10 lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ def send_message(self, event):
except (ValueError, OverflowError):
pass
else:
artists = [a for a in event.inaxes.mouseover_set
if a.contains(event) and a.get_visible()]

if artists:
a = max(enumerate(artists), key=lambda x: x[1].zorder)[1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not a = max(artists, key=lambda x: x.zorder) is the same as this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that it is but to be honest, I didn't check, I just copy/paste from backend_bases.py

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tacaswell as you are the original author of that line, do you see a problem with @Kojoley suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at this earlier today and have a memory of doing it this way intentionally, but no longer remember the why.

The discussion at https://github.com/matplotlib/matplotlib/pull/4813/files is not enlightening and I can not even claim I just carried through some older code.

I think making that change is fine.

if a is not event.inaxes.patch:
data = a.get_cursor_data(event)
if data is not None:
s += ' [%s]' % a.format_cursor_data(data)

message = s
self.toolmanager.message_event(message, self)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.