Hi,
I’m having trouble inserting the %{text} field into the hover template on a facet plot. In my actual code each point on all facets just inherits the first value within the text field.
I’ve tried to recreate the issue with the below code, although there’s still a problem it’s not the one that I’ve described above. Hopefully a solution would fix both issues. In the below example points are being labelled as Male in the hovertext when they’re actually in the Female category.
I’m using a strip plot and it seems to be limited on functionality compared to other plots (e.g. no graph_objects counter part, can’t update marker from within strip). However, the problem also exists if I run the same code but for a scatter plot.
import plotly.express as px
df = px.data.tips()
fig = px.strip(df, x=“total_bill”, y=“time”,
color=“sex”, facet_col=“day”,
custom_data = [“size”, “smoker”, “tip”])fig.update_traces(text = [gender for gender in df[“sex”]],
hovertemplate =
“%{text}” +
“Size: %{customdata[0]}” +
“Smoker: %{customdata[1]}” +
“Tip: %{customdata[2]}” )fig.show()
(had to remove the breaks from the hovertemplate)