I am trying to make an animated plot, which plots the content of my "input" matrix. (input[1,t,x,y,0]=z where x is the x coordinate, y the y coordinate, z the color value and t the time value over which I want to animate my plot)
But when I run the code I only get a static picture of a certain time value. Does anyone have an idea why this is so?
Thanks for any help.
Here is the code:
def plot_fig():
global M
fig = plt.figure(figsize=(5,5))
my_img=plt.imshow(input[1,0,:,:,0],origin='lower',interpolation='nearest',vmin=0.0,vmax=1.0)
plt.colorbar()
plt.axis('off') # no axes
def update(frame_number):
global t
global input
print("update")
t += 1
my_img.set_data(input[1,t,:,:,0])
return my_img
anim = FuncAnimation(fig, update, interval=10)
plt.show()
print("end")