1

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?

Derek O
  • 16,770
  • 4
  • 24
  • 43
MartinCB
  • 11
  • 2
  • answered here: https://stackoverflow.com/questions/73863843/plotly-scatterplot-and-animated-line-plot-in-the-same-figure/73880275#73880275 – Rob Raymond Oct 05 '22 at 16:16

1 Answers1

0

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

MartinCB
  • 11
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 29 '22 at 12:19