3D Surface
Triaxial Ellipsoid
General ellipsoid with three different semi-axes in orange-red gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
# Triaxial ellipsoid
a, b, c = 3, 2, 1.5
u = np.linspace(0, 2*np.pi, 80)
v = np.linspace(0, np.pi, 80)
u, v = np.meshgrid(u, v)
x = a * np.cos(u) * np.sin(v)
y = b * np.sin(u) * np.sin(v)
z = c * np.cos(v)
# Custom colormap
colors = ['#0a0a0f', '#431407', '#F54927', '#F5B027', '#fef08a']
cmap = LinearSegmentedColormap.from_list('orange_red', colors, N=256)
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, alpha=0.9, linewidth=0.1, edgecolor='#ffffff12')
ax.set_xlabel('X', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_ylabel('Y', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_zlabel('Z', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_title("Triaxial Ellipsoid", fontsize=14, color='white', 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([a, b, c])
ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Surface examples
☕