Created
January 24, 2019 09:01
-
-
Save lidopypy/5e6a8828f28145128831a062dac1207e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
''' | |
======================== | |
3D surface (solid color) | |
======================== | |
Demonstrates a very basic plot of a 3D surface using a solid color. | |
''' | |
# This import registers the 3D projection, but is otherwise unused. | |
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import | |
import matplotlib.pyplot as plt | |
import numpy as np | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
a= [0,1000,200,2,0.5,0] | |
# Make data | |
for i,j in enumerate (a): | |
u = np.linspace(0, 2 * np.pi, 1000) | |
v = np.linspace(0, np.pi, 1000) | |
x = i*0.5 * np.outer(np.cos(u), np.sin(v)) | |
y = i*0.5 * np.outer(np.sin(u), np.sin(v)) | |
z = i*0.5 * np.outer(np.ones(np.size(u)), np.cos(v)) | |
ax.plot_surface(x, y, z, color='b',alpha=j*0.001) | |
# Plot the surface | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment