I am animating a time series that has 3600 timesteps. I only want to plot timestep 1200 to 1800 in an animation, however I can only get the animation to run from the very first time step onwards. Below is a simplified version of what I've been trying.
sal = ax1.contourf(X[:,:,1200],Y[:,:,1200],Z[:,:,1200]),100)
def animate(i):
sal = ax1.contourf(X[:,:,i],Y[:,:,i],Z[:,:,i]),100)
anim = FuncAnimation(f, animate, interval=100, frames=len(Seconds[1200:1800]))
The above still starts from 0. I want to be able to specify a starting index of 1200 not 0.
len(Seconds[1200:1800])
returns gives a single value 600
, and according to the docs passing an int
to frames
is the same passing range(x)
. So I think your just animating just the first 600 frames. Try
anim = FuncAnimation(f, animate, interval=100, frames=range(1200,1800))
and let me know if it works!