Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- from itertools import count
- from matplotlib.animation import FuncAnimation
- import random
- index = count()
- x1 = []
- y1 = []
- def animate(i):
- x1.append(next(index))
- y1.append(random.randint(-5, 12))
- plt.cla()
- plt.plot(x1, y1)
- FuncAnimation(plt.gcf(), animate, interval = 1000)
- plt.tight_layout()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement