3D Surface
Parametric Sphere
Unit sphere created using parametric equations with spherical coordinates.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
colors = ['#0a0a0f', '#064e3b', '#10b981', '#6ee7b7']
cmap = LinearSegmentedColormap.from_list('mint', colors, N=256)
u = np.linspace(0, 2*np.pi, 80)
v = np.linspace(0, np.pi, 80)
U, V = np.meshgrid(u, v)
X = np.cos(U) * np.sin(V)
Y = np.sin(U) * np.sin(V)
Z = np.cos(V)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
surf = ax.plot_surface(X, Y, Z, cmap=cmap, linewidth=0, antialiased=True)
ax.set_xlabel('X', color='white', fontsize=10)
ax.set_ylabel('Y', color='white', fontsize=10)
ax.set_zlabel('Z', color='white', fontsize=10)
ax.set_title('Parametric Sphere', color='white', fontsize=14, fontweight='bold', pad=20)
ax.tick_params(colors='#64748b', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#1e293b')
ax.yaxis.pane.set_edgecolor('#1e293b')
ax.zaxis.pane.set_edgecolor('#1e293b')
ax.set_box_aspect([1,1,1])
ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Surface examples
☕