Make a movie with Python-2
Here is another way to make a movie using matplotlib¶
In [1]:
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt, animation
In [ ]:
fig, ax = plt.subplots(nrows=1, ncols=1,dpi=72)
def plot_loop(i):
if i==0:
img = ax.imshow(data1)
ax.set_title('before')
elif(i==1):
img = ax.imshow(data2)
ax.set_title('after')
return img
In [ ]:
ani = animation.FuncAnimation(fig, plot_loop,frames=2, repeat=True)
In [ ]:
ani.save('movie.mp4')
plt.close(fig)