Calmcode - matplot gif: gif


1 2 3 4 5

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)], "sine-wave.gif", duration=200)