Is it Possible to Control the Position of the Hoverlabel Box?

I thought that all the hover labels would automagically orient relative to the size of my Choropleth map but my east coast States are getting cut off. Any suggestions (other than resizing my map size)?


Hi @russmcb
does it help if you use hover trace align attribute?


Thanks @adamschroeder. That’s what I was hoping too, but, alas, it just aligns the text inside hover label box, and I’m looking to align the box itself.

I know you didn’t want to change the graph size, but maybe manually setting margin of the right side would fix the hover from cutting off.
Here’s a relevant conversation on margin

And here’s another conversation that might help.

Thanks @adamschroeder, automargin sort of works when I delete my margin= line (still slight cutoffs but much better). The bummer is that I’ve now got a bunch of blank space on the right side of the map and a much smaller map simply because now there’s enough space to orient all the Hovertext boxes to the right. I know they can “auto-adjust” to left or right since some of the ones further right (like Maine) will sometimes flip to a left side orientation.

If there was a way to programmatically control their orientation I wouldn’t mind creating a dictionary for all 50 states to control each one’s hover label box position… but I can’t seem to find any property anywhere to control the orientation.

Having the same issue on my bar chart hoverlabels:



Hi! Did you get a way to control the hoverlabel position? Thanks. :grinning:

No. I never did, sorry.


I guess this is still not a possibility. I have the same problem, but in my case it’s a problem with the hoverlabel of an annotation that is cut at the bottom:

Annotation being cut

It’d be good to at least select yanchor/xanchor for the hoverlabel.

1 Like

iam facing the same issue…is it possible to show the hoverinfo according to our choice is there any customized way to do ?

hi @ranjith061
do you mean show what info is shown in the hoverbox or control the position of the hoverbox?

Is this something that is even on the radar? I have a unified x hoverlabel for a series of stacked bars and the hover label box completely covers all of the bars, which is obviously not a desired behavior.

I would also love to be able to more granularly control what appears in the label.

For example, I want to get rid of the legend colors that show up in the label. I have ShowLegend set to False although if I print out the fig[‘data’] it shows it set to true.

I’m also struggling to figure out how to get rid of the x-label showing in the left hand corner and trying to figure out whether it is possible to insert a variable (from the dataframe) only once at the top of the hover label. E.g., I have a 100% stacked bar and would like to have the ‘denominator’ displayed only once, at the top, rather than four times, one for each label.

Once I get back to my other computer, I’ll throw up some sample code illustrating the problem.