Adding scatter animations across frames in plotly

25 Views Asked by At

I want to add scatter points over an animation i am doing w/ px.imshow:

# video is a [n_frames, height, width, 3] array
fig = px.imshow(video, animation_frame=0, binary_string=True, height=height)
for i in range(video .shape[0]):
    str_plot = go.Scatter(x=[kp1[0, i], kp2[0, i]], y=[kp1[1, i], kp2[1, i]], mode='markers+lines',
            marker=dict(color='red', size=5), xaxis='x', yaxis='y')
    fig['frames'][i]['data'] = list(fig['frames'][i]['data']) + [str_plot]

This kinda works, where i can see both scatter and img when i move the slider, but not when it plays by itself. I assume there is a better way to do this. Please help.

Thanks!

0

There are 0 best solutions below