Skip to content
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

feat: tooltip #86

Merged
merged 10 commits into from
Aug 15, 2023
Merged

feat: tooltip #86

merged 10 commits into from
Aug 15, 2023

Conversation

flekschas
Copy link
Owner

@flekschas flekschas commented Aug 10, 2023

This PR adds support for showing a tooltip upon hovering a point.

Description

What was changed in this pull request?

This PR adds a new method to the Scatter class called tooltip:

# Enable tooltip via the constructor
scatter = Scatter(data=df, x='mass', y='speed', color_by='group', size=6, tooltip=True)

# Or via the `tooltip` method
scatter.tooltip(true, contents={'color'})

Examples

Screenshot 2023-08-14 at 7 58 53 PM
Screen.Recording.2023-08-14.at.7.58.12.PM.mp4
Screenshot 2023-08-14 at 7 59 35 PM
Screen.Recording.2023-08-14.at.7.56.07.PM.mp4
Screenshot 2023-08-14 at 8 10 22 PM Screenshot 2023-08-14 at 8 10 02 PM

Why is it necessary?

It makes it easier to interpret data points by showing the underlying data that is visually encoded by the x, y, color, opacity, or size channel.

Checklist

  • Provided a concise title as a semantic commit message (e.g. "fix: correctly handle undefined properties")
  • CHANGELOG.md updated
  • Tests added or updated
  • Documentation in API.md/README.md added or updated
  • Example(s) added or updated
  • Screenshot, gif, or video attached for visual changes

The position is determined automatically based on the relative position of the hovered point.
@flekschas flekschas added the enhancement New feature or request label Aug 10, 2023
@flekschas flekschas requested a review from manzt August 10, 2023 15:05
@flekschas
Copy link
Owner Author

flekschas commented Aug 11, 2023

@lmcinnes I spoke with @hamelin at SciPy and he asked about the ability of displaying a tooltip on hovering points. I wonder if this PR might be useful for you guys in the context of https://github.com/TutteInstitute/thisnotthat?

The tooltip content is currently limited to the dimensions of the data frame that are encoded visually but we could expand it to allow displaying other dimensions. I am thinking of something like this:

scatter = Scatter(data=df, x='x', y='y', color='pval')
scatter.tooltip(true, contents={'color', 'another_column'})

Imagine the data frame as four columns in this case: x, y, pval, and another_column.

@flekschas flekschas merged commit e215058 into main Aug 15, 2023
@flekschas flekschas deleted the feature/tooltip branch August 15, 2023 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant