You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default value for the heading (first line of the hover content)is x value in "x unified" and y value in "y unified". It is already possible to customize the format of the x/y value by using xhoverformat and yhoverformat, respectively:
fig.update_traces(xhoverformat="%b") # for x unified
fig.update_traces(yhoverformat="Month: %b") # for y unified
This workaround requires adding a new trace with the information that the developer wants to show hardcoded:
hov_text= [f'🌀 Wind Speed <br><br>{d}<br>Daily average: {w} km/h'
for d, w in zip(dff['date'].dt.strftime('%B %d,%Y'), dff['wind_daily_average'])]
fig = go.Figure()
fig.add_scatter(hovertext=hov_text, hoverinfo='text', ...)
The requested feature would allow the developer to specify the variable or value directly without needing to manually create the text for each x value. It could look like this:
# remove title
fig.update_layout(hovertitle = dict(text=None))
# same title for every x value
fig.update_layout(hovertitle = dict(text="Always the same title"))
# set it to a df variable that is not the x value, or that is a combination of values (similar to the current workaround)
fig.update_layout(hovertitle = dict(text=df["my_custom_value"]))
fig.update_layout(hovertitle = dict(text=f'Max stock price in period: {df["max_by_quarter"]}'))
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Following this forum thread: https://community.plotly.com/t/customizing-text-on-x-unified-hovering/39440
Other examples from the forum:
The default value for the heading (first line of the hover content)is x value in "x unified" and y value in "y unified". It is already possible to customize the format of the x/y value by using
xhoverformat
andyhoverformat
, respectively:Ref: https://plotly.com/python/hover-text-and-formatting/#hover-templates-with-mixtures-of-period-data
In the forum thread, a workaround is shared for other scenarios: https://community.plotly.com/t/customizing-text-on-x-unified-hovering/39440/26
This workaround requires adding a new trace with the information that the developer wants to show hardcoded:
The requested feature would allow the developer to specify the variable or value directly without needing to manually create the text for each x value. It could look like this:
The text was updated successfully, but these errors were encountered: