Created
May 17, 2020 01:09
-
-
Save ulikoehler/bd67a969229b265720f8aa2b5b2352c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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