Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created October 7, 2020 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/10db15d05eda4de9c7d9a68805f8aad1 to your computer and use it in GitHub Desktop.
Save amankharwal/10db15d05eda4de9c7d9a68805f8aad1 to your computer and use it in GitHub Desktop.
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