I'm using plotly to produce a bar chart; I've successfully created a tooltip which shows custom data associated with each bar. I heavily utilized the approach from the following stack overflow question to do so, with some minor changes in implementation because my "custom data" is not always the same each time I run this code.
How to customize hover-template on with what information to show
## for each "Experiment"
fig.add_trace(go.Bar(name = traceName,
x=local_df['variable'],
y=local_df['value'],
customdata = togg,
marker_color = colors[i],
hoverinfo="skip",
hovertemplate="<br>".join(['<b>%{x} Time: %{y:.1f}%</b>'] + togg_data)))
## for the plot online
fig.update_layout(
title='<b>Vehicle States by Experiment</b>',
title_x = 0.5,
xaxis_tickfont_size=14,
template="plotly_white",
yaxis=dict(
title='Time in State (%)',
titlefont_size=16,
tickfont_size=14,
),
legend=dict(
bgcolor="white",
bordercolor="black",
borderwidth = 1
),
hoverlabel=dict(
bgcolor="#787b80",
font_size=12,
font=dict(color='white')
),
barmode='group',
bargap=0.15,
bargroupgap=0.1
)
As you can see, the original trace name still appears, and is often in the way of the plot, legend, or the bars themselves. I thought that perhaps turning hoverinfo
to "skip" would remove the superfluous information, but that hasn't been successful.
Is there a parameter I'm missing which would allow me to turn off this trace label, but leave my tooltip intact?
".join(['%{x} Time: %{y:.1f}%'] + togg_data + "