Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate hover-text-and-formatting.md #204
Conversation
The chart was not plotting the correct country name with the data point in the hover. Just needed to pass in the 'continent' column data from the continent_data dictionary.
|
Thank you @yecatstevir ! In fact I just noticed there are several issues with this example: in the hovertemplate
Does this sound correct to you? Thanks for noticing the problem :-) |
|
Wow that is awesome! Im glad we were able to figure this out. I am very
new to github so I am glad you got back to me. :) Plotly has been fun so
far as I just started a master's degree in data science at University of
Michigan and we are learning about different visualizations.
…On Mon, Nov 18, 2019 at 6:38 AM Emmanuelle Gouillart < ***@***.***> wrote:
Thank you @yecatstevir <https://github.com/yecatstevir> ! In fact I just
noticed there are several issues with this example: in the hovertemplate x
and y are inverted, and the population is the square root of the right
value. I believe this part of the code should be
for continent_name, continent in continent_data.items():
fig.add_trace(go.Scatter(
x=continent['gdpPercap'],
y=continent['lifeExp'],
name=continent_name,
text=continent['country'],
customdata=continent['pop'],
hovertemplate=
"<b>%{text}</b><br><br>" +
"GDP per Capita: %{x:$,.0f}<br>" +
"Life Expectation: %{y:.0f}<br>" +
"Population: %{customdata:,}" +
"<extra></extra>",
marker_size=continent['size'],
))
Does this sound correct to you? Thanks for noticing the problem :-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#204?email_source=notifications&email_token=ABFQYKSLANQVDYIC3NK56EDQUKSGTA5CNFSM4JOIJXN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEKUOXA#issuecomment-555042652>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFQYKQTW6JCLM3JGKOISFTQUKSGTANCNFSM4JOIJXNQ>
.
--
*Stacey Rivet Beck*
|
|
Happy to know you're having fun with Plotly ;-). Would you like to give it a try and make the other changes to this example? |
|
Ah yes, sorry about that, I will go back to take a look. |
|
@emmanuelle if you have a chance, could you please move this over to the plotly.py repo, with the other fixes you found? |
The chart was not plotting the correct country name with the data point in the hover. Just needed to pass in the 'continent' column data from the continent_data dictionary.
Doc upgrade checklist:
unconverted/x/y.mdtox/y.mdplot()oriplot()graph_objshas been renamed tograph_objectsfig = <something>call is high up in each exampletraceobjectsadd_traceandupdate_layoutfig.show()at the end of each examplepxexample at the top if appropriate