Created
September 28, 2018 17:02
-
-
Save Subv/c5f0e72f87f9cb591539c0f364592899 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 numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
fig, ax = plt.subplots() | |
x = np.arange(0, 2*np.pi, 0.01) | |
line, = ax.plot(x, np.sin(x)) | |
def init(): | |
# Inicializa los datos | |
line.set_ydata([np.nan] * len(x)) | |
return line, | |
def animate(i): | |
# Actualiza los datos | |
line.set_ydata(np.sin(x + i / 100)) | |
return line, | |
ani = animation.FuncAnimation( | |
fig, animate, init_func=init, interval=2, blit=True, save_count=50) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment