xxxxxxxxxx
import numpy as np,pylab as pl; pi=np.pi
[a,b,c]=[.01*np.random.randint(30,99)
for i in range(3)]
d,n=np.max([a,2.*b,3.*c]),np.random.randint(5,11)
def coord(m,k,p,n):
t=np.arange(0,k*pi,.1^4*k*pi/n)
return [m*np.sin(pi*t)*np.cos(t),
m*np.sin(pi*t)*np.sin(t)]
pl.figure(figsize=(6,6)); ax=pl.gca()
ax.set_facecolor('silver')
seg=[coord(a,8.95,1.9,n),coord(b,12.18,2.3,n),
coord(c,11.77,1.7,n)]
for [x,y] in seg:
pl.scatter(x,y,s=.1^3,c=.85*np.random.random(3))
st='a=%.2f; b=%.2f; c=%.2f; d=%.2f'
pl.title(st%(a,b,c,d)); pl.grid(c='slategray',alpha=.3)
pl.tight_layout(); pl.show()
No comments:
Post a Comment