Sphere

Plot a 3D sphere with Python

#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
theta, phi = np.linspace(0, 2 * np.pi, 50), np.linspace(0, np.pi, 20)
THETA, PHI = np.meshgrid(theta, phi)
R = 1.0
X = R * np.sin(PHI) * np.cos(THETA)
Y = R * np.sin(PHI) * np.sin(THETA)
Z = R * np.cos(PHI)
fig = plt.figure()
ax = fig.add_subplot(1,1,1, projection='3d')
plot = ax.plot_wireframe(X, Y, Z, rstride=1, cstride=1, linewidth=.1, color='red', antialiased=False, alpha=1)
plt.show()

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment