最近,我一直在使用plotly进行数据可视化。我已经创建了一个图,我需要创建一个新的图。我已经创建了2个流式API令牌,并将它们添加到凭据文件中。我不知道这些流令牌到底是做什么的。我可以使用不同的流式标记来流式传输不同的情节吗?如果可以,请解释如何使用?我可以在多个跟踪上使用相同的流令牌吗?此外,我想知道在情节中流式令牌的目的。
plotly in python:https://plot.ly/python/streaming-tutorial/
最初,我使用一个流式API令牌创建了一个绘图。现在,我想创建另一个单独的图。我需要确保新的plot不会覆盖first plot,为此,我认为可以使用流式标记,尽管不能完全确定。
发布于 2019-04-02 21:45:58
只是为了向你展示一下here展示的工作流程。它要求您在Plotly用户配置文件中设置两个不同的流。
stream_ids = tls.get_credentials_file()['stream_ids']
# Get stream id from stream id list
stream_id_1 = stream_ids[0]
stream_id_2 = stream_ids[1]
# Make instance of stream id object
stream_1 = go.Stream(
token=stream_id_1, # link stream id to 'token' key
maxpoints=80 # keep a max of 80 pts on screen
)
stream_2 = go.Stream(
token=stream_id_2, # link stream id to 'token' key
maxpoints=80 # keep a max of 80 pts on screen
)
# Initialize trace of streaming plot by embedding the unique stream_id
trace1 = go.Scatter(
x=[],
y=[],
mode='lines+markers',
stream=stream_1 # (!) embed stream id, 1 per trace
trace2 = go.Scatter(
x=[],
y=[],
mode='lines+markers',
stream=stream_2 # (!) embed stream id, 1 per trace
)
这将为您做好准备。如前所述,对于您想要显示的每个附加绘图,有必要使用一个additionall流。
https://stackoverflow.com/questions/55460710
复制相似问题