Maik
Maik

Reputation: 39

plotly scatter plot hover text does not work for markers other than circle

I have a plotly scatter plot with hover text for each point. The hover function works if I plot in circle, otherwise the hover function is not working. (for example if I plot in square, the hover text is not showing)

received error message from browser: Uncaught TypeError: Cannot read property ....... at Object.hoverPoints

Upvotes: 0

Views: 643

Answers (1)

PythonNoob
PythonNoob

Reputation: 1052

Don't really know, what you're doing wrong here, but it works for me as expected:

enter image description here

Code:

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.offline as pyo

# Create random data with numpy
import numpy as np

N = 1000
random_x = np.random.randn(N)
random_y = np.random.randn(N)

# Create a trace
trace = go.Scatter(
    x = random_x,
    y = random_y,
    mode = 'markers',
    marker = ({'symbol':'triangle-left'})

)

data = [trace]

pyo.plot(data)

Reference to marker styling

https://plot.ly/python/reference/#scatter-marker-symbol

Upvotes: 1

Related Questions