Greetings,
I would like to implement live streaming with Plotly & Dash (although I am not particularly attached to the latter) such that the view is not reset when the data is updated. My data is not time-series; a new data frame is loaded on each update. The dynamic range is known statically.
I followed these guides (aside from the main docs):
- https://dash.plot.ly/live-updates
- https://github.com/plotly/dash-sample-apps/tree/master/apps/dash-wind-streaming
This is the relevant fragment of my MWE:
@app.callback(dash.dependencies.Output('graph-3d', 'figure'),
[dash.dependencies.Input('interval-component', 'n_intervals')])
def on_timer_3d(n_intervals):
n_points = 1000
x = numpy.random.randn(n_points) + 5
y = numpy.random.randn(n_points) + 5
z = numpy.random.randn(n_points) + 5
w = numpy.random.randn(n_points)
trace = dict(
type='scatter3d',
x=x,
y=y,
z=z,
mode='markers',
marker=dict(
line_width=0,
size=1,
color=w,
colorscale='Jet',
showscale=True,
),
)
axis_layout = dict(
range=(0, 10),
backgroundcolor='#000',
showbackground=True,
gridcolor='#555',
zerolinecolor='#888',
)
layout = go.Layout(
width=700,
height=700,
scene_aspectmode='cube',
scene=dict(
xaxis=axis_layout,
yaxis=axis_layout,
zaxis=axis_layout,
),
paper_bgcolor=BACKGROUND_COLOR,
font=dict(
color=FOREGROUND_COLOR,
),
)
return dict(data=[trace], layout=layout)
This is what it looks like (for reference):
I would like the configuration of the view (such as zoom and orientation) to remain invariant to live updates. How do I do that? I searched the docs thoroughly but couldn’t find any coverage of this issue aside from the above two articles.