-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Hover format or skip #2377
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
Hover format or skip #2377
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7cf2ad0
added statsmodels to dependencies for CI
emmanuelle 73dba81
hover can be a dict for skipping or formatting hover
emmanuelle 659e2b9
Revert "added statsmodels to dependencies for CI"
emmanuelle ed4ba16
ordereddict for py2
emmanuelle 0bb6493
delimiter
emmanuelle e3ec1e2
ordereddict
emmanuelle 2f44bf8
tuple possible in hover_data dict
emmanuelle b799e1e
comment
emmanuelle 003d447
py2
emmanuelle fae0caa
black
emmanuelle 9ec0f26
debug
emmanuelle 9a4cb55
debug
emmanuelle 546dd1a
doc, more tests
emmanuelle 135c412
Merge branch 'master' into hover-format-or-skip
emmanuelle 7170a52
address review comments
emmanuelle 5a66bbf
Merge branch 'hover-format-or-skip' of https://github.com/plotly/plot…
emmanuelle f1ec098
short-circuit instead of bypass flag
nicolaskruchten e524b01
Merge pull request #2397 from plotly/hover_data_mod
emmanuelle a05679e
be more permissive when accepting data in hover dict
emmanuelle b1c2cc3
remove print
emmanuelle 6f1a148
update tutorial
emmanuelle 6fc6710
add docstring to helper function
emmanuelle 3c2a607
changelog
emmanuelle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
37 changes: 37 additions & 0 deletions
37
packages/python/plotly/plotly/tests/test_core/test_px/test_px_hover.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import plotly.express as px | ||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
import plotly.graph_objects as go | ||
from collections import OrderedDict # an OrderedDict is needed for Python 2 | ||
|
||
|
||
def test_skip_hover(): | ||
df = px.data.iris() | ||
fig = px.scatter( | ||
df, | ||
x="petal_length", | ||
y="petal_width", | ||
size="species_id", | ||
hover_data={"petal_length": None, "petal_width": None}, | ||
) | ||
assert fig.data[0].hovertemplate == "species_id=%{marker.size}<extra></extra>" | ||
|
||
|
||
def test_composite_hover(): | ||
df = px.data.tips() | ||
hover_dict = OrderedDict( | ||
{"day": False, "sex": True, "time": False, "total_bill": ".1f"} | ||
) | ||
fig = px.scatter( | ||
df, | ||
x="tip", | ||
y="total_bill", | ||
color="day", | ||
facet_row="time", | ||
hover_data=hover_dict, | ||
) | ||
assert ( | ||
fig.data[0].hovertemplate | ||
== "tip=%{x}<br>total_bill=%{customdata[1]:.1f}<br>sex=%{customdata[0]}<extra></extra>" | ||
) |
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.
Uh oh!
There was an error while loading. Please reload this page.