-
Notifications
You must be signed in to change notification settings - Fork 1
hovertemplate.py #154
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
hovertemplate.py #154
Conversation
python/hovertemplate.md
Outdated
v4upgrade: true | ||
--- | ||
|
||
### Add Hover Template to Pie Chart |
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.
Could you change the title to something more general about hovertemplate like "Customize tooltip text with a hovertemplate"?
python/hovertemplate.md
Outdated
### Add Hover Template to Pie Chart | ||
|
||
To customize the tooltip on your graph you can use [hovertemplate](https://plot.ly/python/reference/#pie-hovertemplate), which is a template string used for rendering the information that appear on hoverbox. | ||
|
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.
Add a see also link to the tutorial on texttemplate you just wrote!
python/hovertemplate.md
Outdated
### Add Hover Template to Pie Chart | ||
|
||
To customize the tooltip on your graph you can use [hovertemplate](https://plot.ly/python/reference/#pie-hovertemplate), which is a template string used for rendering the information that appear on hoverbox. | ||
|
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.
Please explain here how to write the template string: which labels can be used, which formatting etc
python/hovertemplate.md
Outdated
import plotly.io as pio | ||
import pandas as pd | ||
|
||
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv") |
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.
Would it be possible to use px.data.gapminder
so that there's no need to download a file here?
python/hovertemplate.md
Outdated
A = {'target': df['continent'][[i]].unique()} | ||
B.append(A) | ||
|
||
data = [{ |
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.
Could you define a Figure
and a 'Scattertrace using
goconstructors? Also use
fig.showinstead of
pio.show`
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.
yeah that's our preference, but we can't use graph_objects
if we wanna use transform
! Using transform
helps to show information nicely in hovertemplate
... let me see what would be the work around
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 the explanation, now I understand better. We might need to ask @nicolaskruchten for advice here: do we want to insist of transform
with this strange thing that we can't use go
, or should we rather have people use px
here (and hence do not have many examples with transform
)?
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 your PR, I've left a couple of comments, in the same spirit as the texttemplate PR.
So this documentation should be added to https://plot.ly/python/hover-text-and-formatting/ rather than made into a new file. And we should never use |
So its already added to https://plot.ly/python/hover-text-and-formatting/ and the new file was deleted, right? |
Could you also please:
|
Thanks for the review, I made couple of changes. We keep v3 :) |
python/hover-text-and-formatting.md
Outdated
``` | ||
|
||
### Advanced Hover Template | ||
The following example shows how to format hover template. [Here](https://plot.ly/python/v3/hover-text-and-formatting/#dash-example) is an example to see how to format hovetemplate in Dash. |
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.
typo hovetemplate
python/hover-text-and-formatting.md
Outdated
|
||
```python | ||
import plotly.graph_objs as go | ||
import plotly.io as pio |
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.
please port to v4 : graph_objects instead of graph_objs, and remove pio
(we do not need a template here)
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.
oops yes of course 👍
Thanks @Mahdis-z can you also add the dash example from the v3 page? |
ok! |
thanks, 💃! |
Doc upgrade checklist:
unconverted/x/y.md
tox/y.md
plot()
oriplot()
graph_objs
has been renamed tograph_objects
fig = <something>
call is high up in each exampletrace
objectsadd_trace
andupdate_layout
fig.show()
at the end of each examplepx
example at the top if appropriate