Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Data tooltip support#25831

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

Open
yanxinc wants to merge51 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromeslothower:main
Open

Data tooltip support#25831

yanxinc wants to merge51 commits intomatplotlib:mainfromeslothower:main

Conversation

yanxinc
Copy link

@yanxincyanxinc commentedMay 8, 2023
edited
Loading

PR summary

Closes#23378

This adds data tooltip support to the tkinter, qt, gtk3, gtk4, and wx backend. The tooltip is added as a label in the bottom right hand corner whenever the cursor hovers over a data point.

import matplotlibimport matplotlib.pyplot as pltfrom numpy.random import randmatplotlib.use('tkagg')fig, ax = plt.subplots()ax.plot(rand(100), 'o', hover=True)plt.show()

The tooltip can also be set with a list of explicit strings or a user-defined function.

  • explicit string:ax.plot(rand(3), 'o', hover=['London', 'Paris', 'Barcelona'])

  • user-defined function:

def user_defined_function(event):    x, y = round(event.xdata * 10, 1), round(event.ydata + 3, 3)    return f'({x}, {y})'ax.plot(rand(100), 'o', hover=user_defined_function)
  • data dictionary:
x = rand(3)y = rand(3)ax.plot(x, y, 'o', hover={(x[0], y[0]): "London", (x[1], y[1]): "Paris", (x[2], y[2]): "Barcelona"})

PR checklist

symbolic23 reacted with thumbs up emoji
eslothowerand others added30 commitsApril 17, 2023 17:38
Add tooltip API to backend_bases.py and get/set_hover() to artist.pyi
task 2 - added hover backend implementation & tk specific label
Copy link

@github-actionsgithub-actionsbot left a 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 while, please feel free to ping@matplotlib/developers or anyone who has commented on the PR. 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.

@eslothower
Copy link

Looks good! Ready to review.

@yanxincyanxinc marked this pull request as ready for reviewMay 8, 2023 03:11
Copy link
Member

@ksundenksunden left a comment

Choose a reason for hiding this comment

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

Mostly looked closely at the things that were flagging CI such as sphinx warnings.

Broad strokes, I think it looks pretty good, though I would want to take a bit more time to play around with it.

I do think that if this requires changes to other backends we should at least have a plan for achieving feature parity where possible (particularly for gui backends, as this seems to edit tk and qt, but not some of the other options). That doesn't necessarily have to be done inthis PR, but having a plan would be good.

Do you feel comfortable squashing commits down? if not, we can do so on merge.

lucychencysand others added2 commitsMay 19, 2023 16:34
#9)* implemented hover feature for other backends; fixed string list; added dict* fix linter issues* more linter issues---------Co-authored-by: Yanshi Chen <ychen288@u.rochester.edu>
* implemented hover feature for other backends; fixed string list; added dict* fix linter issues* more linter issues* fix documentations---------Co-authored-by: Yanshi Chen <ychen288@u.rochester.edu>
@yanxincyanxinc requested a review fromksundenMay 20, 2023 00:04
@anntzer
Copy link
Contributor

Based on#23378 (comment) I assume@timhoffm's intent was to have some real "native" tooltip which does not live in the toolbar, but can instead span multiple lines.

timhoffm reacted with thumbs up emoji

@tacaswell
Copy link
Member

Thank you for this work, however we are currently unlikely to take it in it's current state.

We have two major concerns:

  • There is not yet a consensus that we want to add aHoverEvent to our set of events
  • The primary thing that[ENH]: Data tooltip support #23378 was asking for was "native" tooltip support (like we have a "native" rectangle for the zoombox). Getting that in first is a prerequisite for considering if we want aHoverEvent.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@ksundenksundenAwaiting requested review from ksunden

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[ENH]: Data tooltip support
10 participants
@yanxinc@eslothower@anntzer@tacaswell@ksunden@melissawm@symbolic23@pm3512@Ebot101@lucychencys

[8]ページ先頭

©2009-2025 Movatter.jp