4

I am using pandas to generate the data for my plotly scatter plot. However when I try to convert a column to a list for the hoverinfo I am unable to successfully compile.

I am using the list function. I have also tried data['id'].values, and data['id'].tolist.

hoverList = list(data.id)
display = go.Scatter(
    x = data['x_data'],
    y = data['y_data'],
    hoverinfo = 'hoverList',
    mode = 'markers',
    name = "data",
    marker = dict(
    size = 6,
    color = 'rgba(76, 224, 128, 0.79)'
    )
)

Output recieved:

Invalid value of type 'builtins.str' received for the 'hoverinfo' property of scatter Received value: 'hoverList'

1 Answer 1

8

I solved the problem. It looks like the hoverinfo paramater can only be 'x', 'y', 'z', 'text', or a few other specified commands. Here is the code that compiled:

display = go.Scatter(
    x = data['x_data'],
    y = data['y_data'],
    text = data['id'],
    hoverinfo = 'text',
    mode = 'markers',
    name = "data",
    marker = dict(
    size = 6,
    color = 'rgba(76, 224, 128, 0.79)'
    )
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.