Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import matplotlib.animation as animation
  4.  
  5. fig, ax = plt.subplots()
  6.  
  7. x = np.arange(0, 2*np.pi, 0.01)      
  8. line,= ax.plot(x, np.sin(x),color ='red')
  9.  
  10. def animate(i):
  11.     line.set_ydata(np.sin(x+i/10.0))
  12.     return line,
  13.    
  14.  
  15.  
  16.  
  17. def init():
  18.     line.set_ydata(np.ma.array(x, mask=True))
  19.     return line,
  20.    
  21. ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init, interval=25, blit=True)
  22. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement