2
votes

Is it possible to format hoverlabel so that the background color is transparent & it's possible to see the plot through the labels?

I can set it to a solid color by e.g. hoverlabel = list(bgcolor = '#fff') but looks like if I try to add transparency, that part of the color string gets ignored. Same with bgcolor = 'rgba(255,255,255,0.05)', doesn't work either. Looks like for markers there is opacity setting, but not for hoverlabels.

Thanks!!

1
Currently setting the opacity for a hoverlabel isn't possible. hoverlabel.opacity is part of an open issue regarding plotly.js - ismirsehregal
I see, thanks for the link! - laxxy

1 Answers

1
votes

I have found (in plotly python), that if you pass hovermode = "x unified" in layout, then if you set bgcolor to some rgba value that includes transparency, it does work! I am not aware of the R code for that but it should be easy to figure out. Here's what it looks like (pretty sick imo!) -

enter image description here

Here's the (python) code-

fig.update_layout(hovermode='x unified', legend=dict(title= None), hoverlabel=dict(bgcolor='rgba(255,255,255,0.75)',
                                                                                  font=dict(color='black')))