3D Surface

Costa Minimal Surface

Embedded minimal surface with three ends - discovered by Costa in 1984, cyan-pink gradient.

Output
Costa Minimal Surface
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

# Approximation of Costa surface pattern
u = np.linspace(-2, 2, 100)
v = np.linspace(-2, 2, 100)
u, v = np.meshgrid(u, v)

# Costa-like surface using modified Enneper approach
x = u * (1 - u**2/3 + v**2)
y = v * (1 - v**2/3 + u**2)
z = u**2 - v**2

# Add some periodic modulation
z = z + 0.3 * np.sin(2*np.pi*u) * np.cos(2*np.pi*v)

# Custom colormap
colors = ['#0a0a0f', '#164e63', '#27D3F5', '#F527B0', '#fda4af']
cmap = LinearSegmentedColormap.from_list('cyan_pink', 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='#ffffff10')

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("Costa Minimal 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=25, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support