Skip to content

Instantly share code, notes, and snippets.

@vaclavcadek
Created September 19, 2017 13:36
Show Gist options
  • Save vaclavcadek/d63b87dba831ab5da86181da8e8a1ba1 to your computer and use it in GitHub Desktop.
Save vaclavcadek/d63b87dba831ab5da86181da8e8a1ba1 to your computer and use it in GitHub Desktop.
def animate(i):
return plt.plot(x[:i], y[:i], c='r')
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
fig = plt.figure(figsize=(12, 8))
plt.xlim(0, 2 * np.pi)
plt.ylim(-1, 1)
anim = animation.FuncAnimation(fig, animate, frames=100)
display(HTML(anim.to_html5_video()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment