Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. from itertools import count
  3. from matplotlib.animation import FuncAnimation
  4. import random
  5.  
  6. index = count()
  7. x1 = []
  8. y1 = []
  9.  
  10. def animate(i):
  11. x1.append(next(index))
  12. y1.append(random.randint(-5, 12))
  13. plt.cla()
  14. plt.plot(x1, y1)
  15.  
  16.  
  17. FuncAnimation(plt.gcf(), animate, interval = 1000)
  18.  
  19. plt.tight_layout()
  20. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement