3D Surface
Dupin Cyclide Surface
Cyclide surface with all lines of curvature being circles in mint-teal gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
# Dupin cyclide parameters
a, b, c = 1.5, 1.2, 0.9
d = np.sqrt(a**2 - b**2)
u = np.linspace(0, 2*np.pi, 80)
v = np.linspace(0, 2*np.pi, 80)
u, v = np.meshgrid(u, v)
h = a - c * np.cos(u) * np.cos(v)
x = (d * (c - a * np.cos(u) * np.cos(v)) + b**2 * np.cos(u)) / h
y = (b * np.sin(u) * (a - d * np.cos(v))) / h
z = (b * np.sin(v) * (c * np.cos(u) - d)) / h
# Custom colormap
colors = ['#0a0a0f', '#042f2e', '#27F5B0', '#14b8a6', '#5eead4']
cmap = LinearSegmentedColormap.from_list('mint_teal', 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("Dupin Cyclide Surface", 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.view_init(elev=20, azim=60)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Surface examples
☕