ale*_*eca 7 python dashboard plotly plotly-dash
好的,所以我想再走一步。我不知道是否可以用破折号。我想创建一个表单(可能是Flask的WTForm)。该表格应具有date和annotation/comments部分。当有人提交表单时,它将保存到数据库中。然后破折号将读取它并显示在图形上。我的图看起来像这样:
在x-axis将date来自FlaskForm代表的事件,它是存储在数据库中,并annotation会在图形本身表明,当我悬停,准确的date
与此类似的东西:

现在,您能否告诉我是否可行?我应该使用什么工具?这只是一个概念,但我认为这对每个人都会有帮助。
小智 1
在绘图中,您可以使用注释显示文本。例子:
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Scatter(
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
)
trace2 = go.Scatter(
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[0, 4, 5, 1, 2, 2, 3, 4, 2]
)
data = [trace1, trace2]
layout = go.Layout(
showlegend=False,
annotations=[
dict(
x=2,
y=5,
xref='x',
yref='y',
text='max',
showarrow=True,
arrowhead=7,
ax=0,
ay=-40
)
]
)
fig = go.Figure(data=data, layout=layout)
iplot(fig)
Run Code Online (Sandbox Code Playgroud)
参考: https: //plot.ly/python/text-and-annotations
希望这能回答你的问题。另请参阅mode='lines+markers+text'散点图(Adding Text to Data in Line and Scatter Plotsplotly doc的部分)
| 归档时间: |
|
| 查看次数: |
582 次 |
| 最近记录: |