Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Plotly: animated 3D plot scatter+line

How can you combine multiple traces into the frame?

I need to make a shape that is essentially a triangle, if you added a line protruding outward from each vertices.

If I am not animating it, I can just make multiple traces and combine the traces:

trace1 = go.Scatter3d(
x=[x[0,0],x[0,3]],  
y=[y[0,0],y[0,3]], 
z=[z[0,0],z[0,3]])

trace2 = go.Scatter3d(
x=[x[0,1],x[0,4]],  
y=[y[0,1],y[0,4]], 
z=[z[0,1],z[0,4]])

trace3 = go.Scatter3d(
x=[x[0,2],x[0,5]],  
y=[y[0,2],y[0,5]], 
z=[z[0,2],z[0,5]])

trace4 = go.Scatter3d(
x=[x[0,0],x[0,1],x[0,2],x[0,0]],  
y=[y[0,0],y[0,1],y[0,2],y[0,0]], 
z=[z[0,0],z[0,1],z[0,2],z[0,0]])

data = [trace1, trace2, trace3, trace4]

But when animating, I can plot the triangle shape, but I can’t see how to add on the additional lines.

fig = go.Figure(frames=[go.Frame(data=go.Scatter3d(x=[x[k,0],x[k,1],x[k,2],x[k,0]], 
                                                   y=[y[k,0],y[k,1],y[k,2],y[k,0]], 
                                                   z=[z[k,0],z[k,1],z[k,2],z[k,0]]), 
name=str(k))
for k in range(nb_frames)])

fig.add_trace(go.Scatter3d(x=[x[0,0],x[0,1],x[0,2],x[0,0]], 
                       y=[y[0,0],y[0,1],y[0,2],y[0,0]], 
                       z=[z[0,0],z[0,1],z[0,2],z[0,0]]))

@LivingOnAFeeling

Would you mind to search first this forum for “animation” or “3d animation” ? I answered many questions on this topic.
From your code pasted here it is obvious that you did not read any doc on animation before.