【发布时间】:2020-09-24 22:51:47
【问题描述】:
我知道有用于跟踪(标记/线)的 hovertemplate/hover_text/ 选项,但我找不到形状这样的东西。 有没有办法在形状上移动时弹出悬停文本?也许是一种解决方法?
例子:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[1.5, 3],
y=[2.5, 2.5],
text=["Rectangle reference to the plot",
"Rectangle reference to the axes"],
mode="markers",
))
fig.add_shape(
# Rectangle reference to the plot
type="rect",
xref="paper",
yref="paper",
x0=0.25,
y0=0,
x1=0.5,
y1=0.5,
line=dict(
color="LightSeaGreen",
width=3,
),
fillcolor="PaleTurquoise",
)
当我将鼠标悬停在这两点上时,我会得到一个带有信息的悬停模板。我怎样才能得到类似的形状?
【问题讨论】: