Advertisement
Guest User

Untitled

a guest
Jan 18th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import matplotlib.animation as animation
  3.  
  4. MAX_FRAMES = 50
  5.  
  6. xs, ys = [], []
  7. obj = None
  8.  
  9. def update(frame_number):
  10.   xs.append(frame_number)
  11.   ys.append(frame_number)
  12.   obj.set_data(xs, ys)
  13.  
  14. fig = plt.figure()
  15.  
  16. ax = plt.axes()
  17. ax.set_ylim(-1, 100)
  18. ax.set_xlim(-1, 100)
  19.  
  20. obj, = plt.plot([], [], 'ro')
  21.  
  22. anim = animation.FuncAnimation(
  23.     fig, update, MAX_FRAMES, interval=100, repeat=False)
  24.  
  25. plt.show()
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement