-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
@nicolaskruchten, thank you for the examples (https://github.com/plotly/plotly.py/issues/2876), I have made small modification to the same code added animation_frame, before the play button is clicked yaxis and hovertext has no "sum of" text but once played we can see hovertext adds again sum of.
Sorry I am new to this not sure if I am doing something stupid
import plotly.express as px
import pandas as pd
import io
data = '''
time name value
0 P1 2
10 P1 4
20 P1 6
30 P1 3
0 P2 1
10 P2 4
20 P2 3
30 P2 2
'''
df = pd.read_csv(io.StringIO(data), delim_whitespace=True)
fig = px.histogram(df, x="name", y="value",color='name',animation_frame="time",range_y=[0,df['value'].max()],color_discrete_sequence=px.colors.qualitative.T10)
fig.for_each_trace(lambda t: t.update(hovertemplate=t.hovertemplate.replace("sum of", "")))
fig.for_each_yaxis(lambda a: a.update(title_text=a.title.text.replace("sum of", "")))
fig.show()
Originally posted by @hrani in #2876 (comment)
Metadata
Metadata
Assignees
Labels
No labels