Draft PR: On adding data tooltip support (#23378)#30133
Open
Dil003 wants to merge 1 commit intomatplotlib:mainfrom
Open
Draft PR: On adding data tooltip support (#23378)#30133Dil003 wants to merge 1 commit intomatplotlib:mainfrom
Dil003 wants to merge 1 commit intomatplotlib:mainfrom
Conversation
There was a problem hiding this comment.
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 us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Member
|
@Dil003 Du you plan to continue with this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.