Skip to content

Instantly share code, notes, and snippets.

@ulikoehler
Created May 17, 2020 01:09
Show Gist options
  • Save ulikoehler/bd67a969229b265720f8aa2b5b2352c7 to your computer and use it in GitHub Desktop.
Save ulikoehler/bd67a969229b265720f8aa2b5b2352c7 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
x = np.arange(0, 2*np.pi, 0.1)
y = np.sin(x)
fig = plt.gcf()
ax = plt.gca()
def plot(ax):
return ax.plot(x, y, animated=True)[0]
line = plot(ax)
def animate(i):
line.set_ydata(np.sin(1*x + i/100.0))
return [line]
# We'd normally specify a reasonable "interval" here...
ani = animation.FuncAnimation(fig, animate, range(1, 200),
interval=0, blit=True)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment