1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/env python
- # -*- coding: UTF-8 -*-
- import numpy as np
- from mpl_toolkits.mplot3d import Axes3D
- import matplotlib.pyplot as plt
- def randrange(n, vmin, vmax):
- return (vmax - vmin)*np.random.rand(n) + vmin
- fig = plt.figure()
- ax = fig.add_subplot(111, projection='3d')
- n = 100
- for xs, ys, zs in [
- (0.993099,0.00679127,1.61979,),(-0.447303,1.69636,-0.729569,),(0.447303,-1.69636,0.729569,),(-0.993099,-0.00679127,-1.61979,),(1.29314,1.37788,0.198094,),(0.410019,-1.37788,-1.24231,),(-0.410019,1.37788,1.24231,),(-1.29314,-1.37788,-0.198094,),(1.82299,-0.522107,-0.118796,),(-0.932773,-0.522107,1.57078,),(0.932773,0.522107,-1.57078,),(-1.82299,0.522107,0.118796,),(0.846647,-0.993106,1.38092,),(1.34382,0.81389,1.06852,),(0.342726,0.81389,1.6823,),(1.65526,-0.302895,0.88226,),(0.0354592,-0.302895,1.87537,),(-0.846647,0.993106,-1.38092,),(0.497169,1.807,-0.312393,),(-0.503921,1.807,0.30138,),(0.285352,1.30398,-1.35211,),(-1.33444,1.30398,-0.359004,),(0.503921,-1.807,-0.30138,),(-0.497169,-1.807,0.312393,),(1.33444,-1.30398,0.359004,),(-0.285352,-1.30398,1.35211,),(-0.342726,-0.81389,-1.6823,),(-1.34382,-0.81389,-1.06852,),(-0.0354592,0.302895,-1.87537,),(-1.65526,0.302895,-0.88226,),(0.519084,1.6198,0.846647,),(1.83161,0.503012,0.0466107,),(1.30836,1.11678,-0.806843,),(-0.519084,-1.6198,-0.846647,),(1.31253,-1.11678,-0.800036,),(0.789273,-0.503012,-1.65349,),(-0.789273,0.503012,1.65349,),(-1.31253,1.11678,0.800036,),(-1.30836,-1.11678,0.806843,),(-1.83161,-0.503012,-0.0466107,),(1.6198,0,-0.993106,),(-1.6198,0,0.993106,),
- ]:
- # xs = rand23, 32)
- # ys = randrange(n, 0, 100)
- # zs = randrange(n, zl, zh)
- ax.scatter(xs, ys, zs, c='b', marker='o')
- ax.set_xlabel('X Label')
- ax.set_ylabel('Y Label')
- ax.set_zlabel('Z Label')
- plt.show()
|