In Matplotlib, I want to draw a sphere with a mesh on its surface, divided into 30 degrees steps in spherical coordinates.
The code:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
u = np.linspace(0, 2 * np.pi, 13)
v = np.linspace(0, np.pi, 7)
x = 10 * np.outer(np.cos(u), np.sin(v))
y = 10 * np.outer(np.sin(u), np.sin(v))
z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x, y, z, rstride=1, cstride=1, color='w', shade=0)
plt.show()
Produces the figure:
However, I want the contours on the sphere to be smooth, rather than drawn directly between the plotted points. If I increase the density of sampling, I get a smoother sphere, but the lines are drawn too densely:
How can I plot lines on a smooth sphere that are separated by 30 degrees?