# go.Scatter and Markers Not Hovering

**URL:** <https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528>\
**Category:** 📊 Plotly Python\
**Created:** [April 20, 2019, 10:49pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528 "2019-04-20T22:49:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![localh85](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@localh85](https://community.plotly.com/u/localh85)\
**Post date:** [April 20, 2019, 10:49pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/1 "2019-04-20T22:49:47Z")

</div>

When I plot markers, I cannot get hover to work at all. It plots like it should, but it does not hover at all.

I am applying the same process I would use for `mode = 'lines'`, which works like it should, meaning hover is functional.

Below is a MWE:

```auto
import pandas as pd
import plotly
import plotly.graph_objs as go

df = pd.DataFrame(columns=['x', 'y', 'text'])

df['x'] = [32.1, 32.3, 32.5, 32.7]
df['y'] = [61.3, 61.5, 61.7, 61.9]
df['text'] = ['Country A', 'Country B', 'Country C', 'Country D']

container = []
for x, plot in df.groupby('text'):
    trace = (go.Scatter(x=plot.x, y=plot.y, mode = 'markers',
                        name = x, hoverinfo ='text', marker = dict(size = 10)))
    container.append(trace)

fig = dict(data=container)
plotly.offline.plot(fig, validate=False) # offline plotting

```

I would appreciate any insight.

---

<div class="post-metadata">

**Author:** ![michaelbabyn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/michaelbabyn/32/3569_2.png) [@michaelbabyn](https://community.plotly.com/u/michaelbabyn)\
**Post date:** [April 21, 2019, 4:34pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/2 "2019-04-21T16:34:33Z")

</div>

@localh85, in the traces above `hoverinfo='text'` but the `text` attribute isn’t set so it gets the default value of `""`. If you set `hoverinfo="name"` you’ll get the behaviour you’re expecting.

---

<div class="post-metadata">

**Author:** ![localh85](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@localh85](https://community.plotly.com/u/localh85)\
**Post date:** [April 21, 2019, 4:46pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/3 "2019-04-21T16:46:43Z")

</div>

Perfect! Thank you very much it @michaelbabyn

Edit; Translating this to my actual data. It works, but hover is now limiting the amount of text shown. Any ideas?

![truncated%20text](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/5/5917166c1fcced8f46874e20e047d208cafcf372.jpeg)

---

<div class="post-metadata">

**Author:** ![michaelbabyn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/michaelbabyn/32/3569_2.png) [@michaelbabyn](https://community.plotly.com/u/michaelbabyn)\
**Post date:** [April 21, 2019, 5:45pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/4 "2019-04-21T17:45:37Z")

</div>

Huh, @localh85. I guess Plotly limits the length of the name attribute shown in hover text. Setting `text=x` in your trace and then switching `hoverinfo='text'` again should do the trick.

---

<div class="post-metadata">

**Author:** ![localh85](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@localh85](https://community.plotly.com/u/localh85)\
**Post date:** [April 21, 2019, 5:59pm UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/5 "2019-04-21T17:59:16Z")

</div>

Yep, that did the trick!

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [April 22, 2019, 11:43am UTC](https://community.plotly.com/t/go-scatter-and-markers-not-hovering/22528/6 "2019-04-22T11:43:47Z")

</div>

For future reference, you can also directly control the display width of the hover label using the [`scatter.hoverlabel.namelength`](https://plot.ly/javascript/reference/#scatter-hoverlabel-namelength) property.

-Jon
