Animated scatter plot example from python lists

According to the animation examples in the docs, I need columns and grids for an animated plot like this and I need to create a frame for every frame of the animation.

column_1 = Column([0.5], β€˜x’)
column_2 = Column([0.5], β€˜y’)
column_3 = Column([1.5], β€˜x2’)
column_4 = Column([1.5], β€˜y2’)

grid = Grid([column_1, column_2, column_3, column_4])

However, I have two lists with equal lengths:

x = [1, 2, 3, 4, … 1000]
y = [1,5,10,15,20,…10000]

My python skills aren’t developed enough yet to interlace and column-ify the simple lists into the grid and create a frame for every x / y pair. Can someone help give me a snippet of code that does this? i found an exmaple using dataframes and pandas to get the grid built, but I’m not sure of an approach to getting 1000 frames built out from these 1000 x/y pairs.

Hi @jsm,

I’m not sure I understand how you would like your x and y lists to be interleaved into the grid.

Also, you might want to consider building the animation in offline mode so you don’t need to deal with build a grid (https://plot.ly/python/animations/#online-mode).

If you would like to upload the plot to Chart Studio, in plotly.py 3.7 (out in a week or so) it will be possible to upload an animated plot built in offline mode using plotly.plotly.create_animations().

-Jon

Jon,

I’ll look into that. My issue is that I have a series of x/y points as two separate lists and I’d like to animate the progression of the points.

I’m not sure if plotly is the right tool for the job. The data I have is time vs distance data (1 dimensional) and I want to play back visually how a race over that distance unfolded.

The data I have is in a csv that I can read into a grid via pandas, but it is a single column (list) and not organized like frames. I’d have to pivot the column to a row to convert it to a frame construct I think.