Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Plotly animations redraw=false causes animations to dissapear

Hi All,

Playing around with some 3D scatter animations and am encountering some issues when switching redraw to False. Basically, my scatter points stop appearing when I move my slider but can switch the trace on and off and it reappears. Anyone know how this can be resolved?

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', visible=True,# animations performance issue:
                           x=sData['LOC_X'][:k+1]+1000, ## rendering all scatter data every frame.
                           y=sData['LOC_Y'][:k+1]-583000,
                           z=sData['LOC_Z'][:k+1]*-1)],
               traces=[0], 
               name='frame{}'.format(k)       
              #)for k  in  range(1, len(sData))] 
               )for k in range(1, 1000)]

layout = go.Layout(
    autosize=True,
    hovermode='closest',
    xaxis=dict(
        showticklabels=False
    )
)

sliders = [dict(steps= [dict(method='animate', visible=True,
                           args= [['frame{}'.format(k)],
                                  dict(mode='immediate',
                                  frame= dict( duration=100, redraw=False, visible=True), # test here?
                                            #redraw=False,
                                            #visible=True,
                                            transition=dict( duration= 0)
                                          )
                                    ],
                            #label='{:d}'.format(k)
                            label=sData['JobTime'][k]
                             ) for k in range(1000)], 
                transition= dict(duration=0),
                x=0,#slider starting position  
                y=0, 
                visible=True,
                currentvalue=dict(font=dict(size=12), 
                                  prefix='Time: ', 
                                  #visible=True, 
                                  xanchor='center'),  
                len=1.0)
           ]

layout.update(updatemenus=[dict(type='buttons', showactive=True,
                            y=-0.06,
                            x=-0.015,
                            buttons=[dict(label='Play',
                            method='animate',
                            args=[None, 
                                dict(frame=dict(duration=100,
                                                redraw=True, visible=True),
                                        transition=dict(duration=1),
                                        fromcurrent=True, mode='immediate') 
                                ]
                        )
                    ]
                )
            ],
        sliders=sliders)


print(sData)
fig = go.Figure(data=data, layout=layout, frames=frames)

@jrotta I cannot run your code without data :frowning:

Any news on this? I have the same issue. My 3D scatter plot animation works great, but as soon as I change ‘redraw’ to False to make it faster, it doesn’t animate anymore.