'How to plot two plotly figures with common animation_frame

I am trying to plot both a scatterplot and a line plot, in the same figure. One is for objects and the other for lane markers. The outcome should be one figure with one time slider, that will update both objects and lane markers.

Current code

fig3 = go.Figure()
fig1 = px.line(data_frame=objects,x="Long", y="Lat",color="ObjID", animation_frame="rounded_time")
fig2 = px.scatter(data_frame=lanes,x="y", y="x", color="Location", animation_frame="rounded_time")
fig3 = go.Figure(data=(fig1.data + fig2.data))

This gives me a nice plot but missing the animation slider:

plotly_output

Is there any easy way to add plots to the same figure while retaining the animation_frame?



Solution 1:[1]

So, after a lot of googling I have found nothing on this. I think I have to use Plotly Graph Objects to achieve this.

So right now I am trying to learn how to use plotly go, having hard time finding any tutorials on plotly go, plenty on plotly express though..

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MartinCB