Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib as mpl
- mpl.use('TkAgg')
- from math import cos,sin,pi
- import numpy as np
- from mpl_toolkits.mplot3d import axes3d
- import matplotlib.pyplot as plt
- fig = plt.figure()
- ax = fig.add_subplot(111, projection='3d')
- ax.auto_scale_xyz([0, 500], [0, 500], [0, 0.15])
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
- U = np.arange(-1, 1, 0.005)
- V = np.arange(-1, 1, 0.005)
- def animate():
- for ch in [0.2*i*pi for i in range(3)]:
- Us, Vs = np.meshgrid(U, V)
- Xs = Us*cos(ch) + sin(ch)*(Us**2)
- Ys = Vs
- Zs = -Us*sin(ch) + cos(ch)*(Us**2)
- tmp = ax.plot_surface(Xs,Ys,Zs, alpha=0.05)
- fig.canvas.draw()
- tmp.remove()
- win = fig.canvas.manager.window
- fig.canvas.manager.window.after(100, animate)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement