Facetted subplots tick formatting hover template

Hello,

I am creating a bar chart with multiple columns and want to change the tick formatting on the hover template. Using fig.for_each_yaxis(lambda yaxis: yaxis.update(tickformat=".2%")) updates the yaxis formatting and does update the hover template of the first column plot, but it does not update the other columns. I expected this to work for all columns or do I have to manually change the hover template for this to work?

df = px.data.tips()
fig = px.bar(
    df,
    x="sex",
    y="total_bill",
    color="smoker",
    barmode="group",
    facet_col="day",
    category_orders={"day": ["Thur", "Fri", "Sat", "Sun"]},
)
fig.for_each_yaxis(lambda yaxis: yaxis.update(tickformat=".2%"))

st.plotly_chart(fig)

The example is based on Bar charts in Python

Hey @yann1ck welcome to the forums.

This sounds pretty similar to Update_yaxes behavior when using make_subplots vs specifying axes directly

1 Like

Hi, this seems to be exactly the same problem. Thank you for the link.

1 Like