简体   繁体   中英

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:

情节输出

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

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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM