... matplot gif: gif


Remember that you do need to have gif installed to run this code.

import gif
import numpy as np
import matplotlib.pylab as plt

def frame(i):
    x = np.linspace(0, 2*np.pi, 100)
    y = np.sin(x)
    plt.plot(x, y)
    plt.scatter([x[i]], [y[i]]);

frames = [frame(i) for i in range(100)]

gif.save(frames, "sine-wave.gif", duration=200)

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider signing up for the newsletter.