Plotting A Wireframe Sphere In Python Hidding Backward Meridians And Parallels
In this question we are shown how to plot (among many other things) a sphere: Python/matplotlib : plotting a 3d cube, a sphere and a vector? It's very nice but I would like to plot
Solution 1:
The idea of a wireframe plot is to make is see-through such that features behind the object are still visible. So instead of a wireframe you probably want to plot a surface plot:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_aspect("equal")
# draw sphere
u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j]
x = np.cos(u)*np.sin(v)
y = np.sin(u)*np.sin(v)
z = np.cos(v)
ax.plot_surface(x, y, z, color="w", edgecolor="r")
plt.show()
Post a Comment for "Plotting A Wireframe Sphere In Python Hidding Backward Meridians And Parallels"