From the plotly Bar charts tutorial in the example ‘Bar Charts with Direct Labels’, whenever we hover on the graph, the value of the graph is shown twice. Is there a way to fix that?
I think you go get rid of it by putting a
name = ''
inside the go.Bar()
So something like this:
go.Bar( x = [10,20,30], y = [1,2,3], name = '', # removes extra legend on hover text = key, marker=dict( color = the_color, line=dict( color='rgb(0,0,0)', width=1.0 ) )
Unfortunately it doesn’t work
Hmm… Then I believe this may be caused by plotly trying to show you both the value of the data and whatever is defined in the variable “text” in the go.Bar()
Looking at https://plot.ly/python/reference/#bar it seems that we can manipulate displayed information on hover under the “hoverinfo” tag. Try writing something like
go.Bar( x = [10,20,30], y = [1,2,3], hoverinfo = "text" # or hoverinfo = "y" text = ['apples', 'oranges', 'bananas'], marker=dict( color = the_color, line=dict( color='rgb(0,0,0)', width=1.0 ) )
Yes! Setting hoverinfo to “y” did the trick!
Thanks a lot!