Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Draft PR: On adding data tooltip support (#23378)#30133
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
Hello there,
This pull request introduces basic native tooltip support in Matplotlib, addressing issue#23378. The goal is to enable tooltips that display arbitrary user-defined data, and not just coordinates, when hovering over data points.
I’m new to contributing to the Matplotlib open-source project, and with this implementation, I’ve done my best to follow the development guidelines.I welcome any feedback for improvement. I have also reviewed the previous pull request#25831, which was rejected, and I want to ensure my current approach aligns better with Matplotlib’s goals. At this stage, I would greatly appreciate feedback on whether I’m heading in the right direction.
The following components are currently working:
High-level API support:
plt.plot(x, y, tooltip=['A', 'B', 'C']) now accepts the tooltip argument. Tooltip data is correctly extracted from kwargs in axes.py.
Data storage system:
Artists support set_tooltip() and get_tooltip().
Tooltips support:
Strings (e.g. "Data point")
Lists (e.g. ['A', 'B', 'C'])
Functions (e.g. lambda x, y: f'({x}, {y})')
Basic infrastructure:
Canvas includes show_tooltip() and hide_tooltip()
Figure implements _on_mouse_move_for_tooltip() to handle mouse movement
Local installation works using pip install -e .
I have tested the following so far:
Tooltip data is being stored correctly:


My backend supports tooltip-related data functions:
What I currently need help with is mouse event detection. At the moment, hovering over data points does not trigger the tooltip display. Since adding this feature touches many parts of the codebase, I am unsure how to properly integrate this with Matplotlib’s existing event-handling system. Any guidance or suggestions would be greatly appreciated.