I would like to change the y-axis title of a histogram in plotly python. We could use the fig.update_layout(yaxis_title="New y-axis title")
to change the title of the y-axis. But this doesn't automatically change the hover title of the y-axis. We could use the labels
argument to change the title of the x-axis and hover title but this doesn't work for the y-axis title with count. Here is some reproducible code:
import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x="total_bill",
labels={"total_bill": "Total bill"})
fig.update_layout(yaxis_title="New y-axis title")
fig.show()
Output:
As you can see the y-axis title is nicely changed, but the hover title isn't changed. So I was wondering if anyone knows how to fix this issue?