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,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,),
- ]:
- # 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()
|