So, I learned how to make cute little animations in matplotlib. For example, this:
import numpy as np
import matplotlib
import matplotlib.pyplot as pltplt.ion()fig = plt.figure()
ax = fig.add_subplot(111) ax.set_xlim(0, 1)
ax.set_ylim(-2,2)dt = 0.01
q = 0.01
t = np.arange(0,1,dt)
x = np.sin(2*np.pi*t)
line, = ax.plot(t,x, '-')
fig.canvas.draw()
for i in xrange(100):x = (1-q) * x + q* np.random.normal(size = len(t))line.set_ydata(x)fig.canvas.draw()
This works and it's very nice. But how I use this to make a movie I can display, for example, in a pdf presentation? I tried to do fig.savefig("test.gif")
but there's an error message indicating that matplotlib doesn't export gifs.
Is there a way of doing this without resorting to external tools (like making a lot of png's and stitching them together)?