Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. """ 3d plot """
  2. fig2 = pyplot.figure(2,figsize=(10,10))
  3. ax = pyplot.axes(projection='3d')
  4. # head
  5. head_theta = numpy.linspace(-numpy.pi/2,numpy.pi/2)
  6. head_phi = numpy.linspace(0,2*numpy.pi)
  7. theta,phi = numpy.meshgrid(head_theta,head_phi)
  8. headx = 10*numpy.cos(theta)*numpy.cos(phi)
  9. heady = 10*numpy.cos(theta)*numpy.sin(phi)
  10. headz = 10*numpy.sin(theta)
  11. ax = fig2.add_subplot(111, projection='3d')
  12. ax.plot_surface(headx,heady,headz,rstride=1,cstride=1,zorder=0)
  13. # hairs
  14. xyz_coords = shooting(4,10,0.05,0.1,latitudes,longitudes)
  15. for i in range(len(latitudes)):
  16.     for j in range(len(longitudes)):
  17.         hairx = xyz_coords[i][j][0]
  18.         hairy = xyz_coords[i][j][1]
  19.         hairz = xyz_coords[i][j][2]
  20.         ax.plot3D(hairx,hairy,hairz,'black',zorder=5)
  21. ax.view_init(elev=10,azim=40)
  22. ax.set_xlabel("x")
  23. ax.set_ylabel("y")
  24. ax.set_zlabel("z")
  25. ax.set_title("3d plot")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement