Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Oct 7, 2020
Embed
What would you like to do?
def spheres(size, clr, dist=0):
# Set up 100 points. First, do angles
theta = np.linspace(0,2*np.pi,100)
phi = np.linspace(0,np.pi,100)
# Set up coordinates for points on the sphere
x0 = dist + size * np.outer(np.cos(theta),np.sin(phi))
y0 = size * np.outer(np.sin(theta),np.sin(phi))
z0 = size * np.outer(np.ones(100),np.cos(phi))
# Set up trace
trace= go.Surface(x=x0, y=y0, z=z0, colorscale=[[0,clr], [1,clr]])
trace.update(showscale=False)
return trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment