Skip to content

Instantly share code, notes, and snippets.

@parulnith
Last active April 13, 2019 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parulnith/8e55323704750049f875684b65b37cde to your computer and use it in GitHub Desktop.
Save parulnith/8e55323704750049f875684b65b37cde to your computer and use it in GitHub Desktop.
import matplotlib
from matplotlib import pyplot as plt
from celluloid import Camera
fig = plt.figure()
camera = Camera(fig)
for i in range(20):
t = plt.plot(range(i, i + 5))
plt.legend(t, [f'line {i}'])
camera.snap()
animation = camera.animate()
animation.save('celluloid_legends.gif', writer = 'imagemagick')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment