Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import matplotlib as mpl
  2. mpl.use('TkAgg')
  3. from math import cos,sin,pi
  4. import numpy as np
  5. from mpl_toolkits.mplot3d import axes3d
  6. import matplotlib.pyplot as plt
  7.  
  8. fig = plt.figure()
  9. ax = fig.add_subplot(111, projection='3d')
  10. ax.auto_scale_xyz([0, 500], [0, 500], [0, 0.15])
  11.  
  12. ax.set_xlabel('X')
  13. ax.set_ylabel('Y')
  14. ax.set_zlabel('Z')
  15.  
  16. U = np.arange(-1, 1, 0.005)
  17. V = np.arange(-1, 1, 0.005)
  18. def animate():
  19. for ch in [0.2*i*pi for i in range(3)]:
  20. Us, Vs = np.meshgrid(U, V)
  21. Xs = Us*cos(ch) + sin(ch)*(Us**2)
  22. Ys = Vs
  23. Zs = -Us*sin(ch) + cos(ch)*(Us**2)
  24. tmp = ax.plot_surface(Xs,Ys,Zs, alpha=0.05)
  25. fig.canvas.draw()
  26. tmp.remove()
  27.  
  28. win = fig.canvas.manager.window
  29. fig.canvas.manager.window.after(100, animate)
  30. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement