我有一个散点图,每个点都有悬停文本。如果我在圆圈中绘制,悬停功能将起作用,否则悬停功能将不起作用。(例如,如果我以正方形绘制,则悬停文本不会显示)
从浏览器收到错误消息:Uncaught TypeError: Cannot read property .. at Object.hoverPoints
我有一个散点图,每个点都有悬停文本。如果我在圆圈中绘制,悬停功能将起作用,否则悬停功能将不起作用。(例如,如果我以正方形绘制,则悬停文本不会显示)
从浏览器收到错误消息:Uncaught TypeError: Cannot read property .. at Object.hoverPoints
真的不知道,你在这里做错了什么,但它按预期对我有用:
代码:
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)
参考标记样式
https://plot.ly/python/reference/#scatter-marker-symbol