Simple matplotlib animation

I have an array with coordinates and speeds of a set of particles, for example x and v.

I can calculate their evolution using a script that I already wrote in Python, but I would like to visualize a simple animation of their movement in space x, v

How can I just update the graph at each iteration?

The code can be roughly written as

sets the initial x, v of each particle in the array

for k in the range (1, N_iterations):

calculates each new position and speed of each particle (the part that I already wrote)

displays the updated array in space x, v

waiting for a set time interval

the cycle continues

0
source share

All Articles