Hi All,
I’m plotting a cumulative scatter animation using scatter3D and have encountered some issues with performance. The main one being that I’m rendering large amounts of data each frame. Notice when I declare my ‘frames’ there are moments where I’m re-rendering thousands of scatter dots every frame. Is there a way that I can store previous scatter data and only render one at a time? Instead of re-rendering them all? Is there support for a Scatter3dgl? Thanks!
#colorArr = build_color_arr()
micro_trace = go.Scatter3d(
x=[],
y=[],
z=[],
mode='markers',
marker=dict(
size=sData['RADIUS'] - (sData['RADIUS'] * .75),
color=sData['RADIUS'],
colorscale='rainbow'
)
)
data = [micro_trace]
frames = [dict(data= [dict(type='scatter3d', # animations performance issue:
x=sData['LOC_X'][:k+1], ## rendering all scatter data every frame.
y=sData['LOC_Y'][:k+1],
z=sData['LOC_Z'][:k+1]*-1)],
traces=[0],
name='frame{}'.format(k)
#)for k in range(1, len(scatterDf))]
)for k in range(1, 3000)]
layout = go.Layout(
autosize=True,
hovermode='closest',
xaxis=dict(
showticklabels=False
)
)
sliders = [dict(steps= [dict(method='animate',
args= [['frame{}'.format(k)],
dict(mode='immediate',
frame= dict( duration=100, redraw=True ),
transition=dict( duration= 0)
)
],
#label='{:d}'.format(k)
label=sData['JobTime'][k]
) for k in range(3000)],
transition= dict(duration=0),
x=0,#slider starting position
y=0,
currentvalue=dict(font=dict(size=12),
prefix='Time: ',
visible=True,
xanchor= 'center'),
len=1.0)
]
layout.update(updatemenus=[dict(type='buttons', showactive=False,
y=-0.06,
x=-0.015,
buttons=[dict(label='Play',
method='animate',
args=[None,
dict(frame=dict(duration=100,
redraw=False),
transition=dict(duration=0),
fromcurrent=True, mode='immediate')
]
)
]
)
],
sliders=sliders)
print(sData)
fig = go.Figure(data=data, layout=layout, frames=frames)