Guest User

Untitled

a guest
May 27th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. from mpl_toolkits.mplot3d import Axes3D
  2. from matplotlib import cm
  3. from matplotlib.ticker import LinearLocator, FormatStrFormatter
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6.  
  7. fig = plt.figure()
  8. ax = fig.gca(projection='3d')
  9. X = np.arange(-5, 5, 0.25)
  10. Y = np.arange(-5, 5, 0.25)
  11. X, Y = np.meshgrid(X, Y)
  12. R = np.sqrt(X**2 + Y**2)
  13. Z = np.sin(R)
  14. surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.winter,
  15. linewidth=0, antialiased=True)
  16. ax.set_zlim(-1.01, 1.01)
  17.  
  18. ax.zaxis.set_major_locator(LinearLocator(10))
  19. ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
  20.  
  21. plt.show()
Add Comment
Please, Sign In to add comment