-
-
Save amankharwal/10db15d05eda4de9c7d9a68805f8aad1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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