Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

How can I change the hover text on the x-axis?

When I hover, in the x-axis this is the info showed.

It is a percentage value. I would like to add the absolute value,
and insted of just “77.3”, show something like “77.3% (4313 times)”

I did it for y-axis info.

But I can’t for x-axis.

Thank you!!


Try the same method like for yaxis, but for xaxis make the following update:

fig.update_xaxes(tickangle=-45)  # or tickangle=45

I think in your attempt it didn’t work for xaxis, because the ticklabel string is too long. It is possible that the above set tickangle to lead to the desired plot.