Hoverinfo cannot be disabled


#1

I am currently customising a Wind Rose chart in Dash…I’d like to disable all hover events for a particular trace, but it simply will not disappear! I’m using Python.

Here is a screenshot of the hoverinfo that continues to pop up:

Here is my code to create the figure, which I then simply add to the Dash app:

trace3 = go.Area(
    r=[40.0, 41, 42, 30.0, 31, 32, 30.0, 33, 34, 35.0, 36, 37, 7.5, 8, 9, 7.5, 9, 10, 32.5, 34, 35, 40.0, 41, 42],
    t=t,
    name='5-8 m/s',
    marker=dict(
        color='rgb(203,201,226)',
    )
)
trace4 = go.Area(
    r=[20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
    t=t,
    name='< 5 m/s',
    marker=dict(
        color='rgb(242,240,247)'
    ),
    hoverinfo="skip"
)
data = [trace3, trace4]
layout = go.Layout(
    title='',
    font=dict(
        size=16
    ),
    legend=dict(
        font=dict(
            size=16
        )
    ),
    radialaxis=dict(
        ticksuffix='%',
        visible = False,
        showgrid=False,
        showline=False
    ),
    angularaxis=dict(
        visible=False,
        showgrid = False,
        showline = False
    ),
    grid=dict(xgap=0,ygap=0),
    orientation=270
)
fig = go.Figure(data=data, layout=layout)

#2

@ADS
hoverinfo='none'
does the job.


#3

@empet Sadly this doesn’t work for me, are you getting it to work on your side? Perhaps there’s an issue with my environment.


#4

@ADS help(go.Area) in Plotly 3.0.0 displays the following information on `hoverinfo’:

hoverinfo
 |          Determines which trace information appear on hover. If
 |          `none` or `skip` are set, no information is displayed
 |          upon hovering. But, if `none` is set, click and hover
 |          events are still fired.

#5

@empet I’m not sure what you’re saying…using either of those parameter settings doesn’t give me the required solution. Are you suggesting that I’m trying to change the wrong thing?


#6

I wanted to let you know how hoverinfo is expected to work in plotly 3.0.0. What plotly version are you using?


#7

I’ve tried this out using plotly 2.7 and 3.0 and I cannot get hover disabled for this kind of graph using hoverinfo or layout->hovermode.


#8

@ADS I tried to define myself an area plot. Indeed this legacy polar plot doesn’t hide the r, t values, even when hoverinfo='none'. It is recommended to use the newer chart type, go.Scatterpolar, instead: https://plot.ly/python/reference/#scatterpolar.
For this type of plot hoverinfo='none' works properly, but the settings

showgrid=False,
showline=False

for the radial and angularaxis in your layout above are not valid anymore.

With your trace3 and this code:

trace3 = dict(type='scatterpolar',
              r=[40.0, 41, 42, 30.0, 31, 32, 30.0, 33, 34, 35.0, 36, 37, 7.5, 8, 9, 7.5, 9, 10, 32.5, 34, 35, 40.0, 41, 42],
              theta=[0, 25, 37, 52, 63, 79, 90, 128, 147, 180, 210, 270, 310, 0],
              name='5-8 m/s',
              fill = 'toself',
              fillcolor = '#ffaa70',
              line =  dict(color = 'black'),
              hoverinfo='none'
             )

layout = dict(title='',
              font=dict(size=16),
              legend=dict(font=dict(size=16)),
              radialaxis=dict(ticksuffix='%',
                              visible = False,
                              #showgrid=False,
                              #showline=False
                              ),
              angularaxis=dict(visible=False,
                               #showgrid = False,
                               #showline = False
                              ),
            )
   
fig = dict(data=[trace3], layout=layout)
iplot(fig)

I generated this image: