Hi Plotly Wizards!
I am trying to make a plotly.express.histogram with histnorm="percent" to show count of observations in hover over tooltip instead of percent. Any tips?
This is what you get with the following code, I just want count instead of percent.
Thanks for the response! I did look into to the hover text documentation before posting here, but it didnβt seem to work for my specific case. Here is a minimal self contained example:
Apologies, I see your problem. As far as I know the only way to dig into this sort of thing is to wrap a figure in a small Dash app, create a callback for βhoverDataβ, and examine what gets returned, which is the same as the data that can be shown on hover.
It turns out for px.histogram() there is only one y value available, which is a percentage if you use histnorm=βpercentβ and a count if you donβt, so it looks like the hover data is linked to the y axis display. One way to get around this might be to display counts in the histogram, and then to modify the tick labels on the y axis so they show percentage values. Another might be to calculate the histogram values in code and then display them using px.Bar(), which should allow customdata to be passed and then shown in the hover display.