print3d-verts.py 1.7 KB

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. import numpy as np
  4. from mpl_toolkits.mplot3d import Axes3D
  5. import matplotlib.pyplot as plt
  6. def randrange(n, vmin, vmax):
  7. return (vmax - vmin)*np.random.rand(n) + vmin
  8. fig = plt.figure()
  9. ax = fig.add_subplot(111, projection='3d')
  10. n = 100
  11. for xs, ys, zs in [
  12. (0,0.0661314,0.107003,),(0,0.0661314,-0.107003,),(0,-0.0661314,0.107003,),(0,-0.0661314,-0.107003,),(0.0661314,0.107003,0,),(0.0661314,-0.107003,0,),(-0.0661314,0.107003,0,),(-0.0661314,-0.107003,0,),(0.107003,0,0.0661314,),(-0.107003,0,0.0661314,),(0.107003,0,-0.0661314,),(-0.107003,0,-0.0661314,),(0,0,0.125789,),(0.0388711,0.101766,0.0628947,),(-0.0388711,0.101766,0.0628947,),(0.0628947,0.0388711,0.101766,),(-0.0628947,0.0388711,0.101766,),(0,0,-0.125789,),(0.0388711,0.101766,-0.0628947,),(-0.0388711,0.101766,-0.0628947,),(0.0628947,0.0388711,-0.101766,),(-0.0628947,0.0388711,-0.101766,),(0.0388711,-0.101766,0.0628947,),(-0.0388711,-0.101766,0.0628947,),(0.0628947,-0.0388711,0.101766,),(-0.0628947,-0.0388711,0.101766,),(0.0388711,-0.101766,-0.0628947,),(-0.0388711,-0.101766,-0.0628947,),(0.0628947,-0.0388711,-0.101766,),(-0.0628947,-0.0388711,-0.101766,),(0,0.125789,0,),(0.101766,0.0628947,0.0388711,),(0.101766,0.0628947,-0.0388711,),(0,-0.125789,0,),(0.101766,-0.0628947,0.0388711,),(0.101766,-0.0628947,-0.0388711,),(-0.101766,0.0628947,0.0388711,),(-0.101766,0.0628947,-0.0388711,),(-0.101766,-0.0628947,0.0388711,),(-0.101766,-0.0628947,-0.0388711,),(0.125789,0,0,),(-0.125789,0,0,),
  13. ]:
  14. # xs = rand23, 32)
  15. # ys = randrange(n, 0, 100)
  16. # zs = randrange(n, zl, zh)
  17. ax.scatter(xs, ys, zs, c='b', marker='o')
  18. ax.set_xlabel('X Label')
  19. ax.set_ylabel('Y Label')
  20. ax.set_zlabel('Z Label')
  21. plt.show()