matplotlib - Use 3d object as marker in 3d scatter plot - Python -


with below code, i'm trying model bowl built out of cans. each marker can, best way go this?

i'd appreciate suggestions, thanks.

    import pylab     import numpy np     math import pi, sin, cos     import matplotlib.pyplot plt     mpl_toolkits.mplot3d import axes3d     fig = plt.figure()     ax = fig.add_subplot(111, projection='3d')      numcanshigh = 24     startcannum = 15     hcan = 41     dcan = 85     rcan = dcan/2.0      # rise options: 0,1,2,3      baserise = 3     toprise  = 2     changeh = 8      z = np.linspace(0, hcan*numcanshigh, num=numcanshigh)      n=[startcannum]     in range(1, changeh):         n.append(n[i-1] + baserise)     in range(changeh,len(z)):         n.append(n[i-1] + toprise)      r = [i*rcan/(pi) in n]      theta = [2*pi / in n]      totalcans = 0      in range(len(z)):         j in range(int(n[i])):             totalcans+=1             x9 = r[i]*cos(j*theta[i])             y9 = r[i]*sin(j*theta[i])             z9 = z[i]             ax.scatter(x9,y9,z9,s=500,marker='s')       plt.show() 


Comments

Popular posts from this blog

php - Global connection variable or new one every time -

c++ - protocol buffers - generate NON-inline accessors -