3D Surface

Lemniscate Revolution Surface

Surface of revolution generated by rotating a lemniscate curve in blue-indigo gradient.

Output
Lemniscate Revolution Surface
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

# Lemniscate of Bernoulli revolved
a = 1.5
t = np.linspace(-0.99*np.pi/4, 0.99*np.pi/4, 100)
v = np.linspace(0, 2*np.pi, 80)
t, v = np.meshgrid(t, v)

# Lemniscate in polar: r^2 = a^2 * cos(2*theta)
r = a * np.sqrt(np.abs(np.cos(2*t)))
x = r * np.cos(t) * np.cos(v)
y = r * np.cos(t) * np.sin(v)
z = r * np.sin(t)

# Custom colormap
colors = ['#ffffff', '#e0e7ff', '#276CF5', '#4927F5', '#a78bfa']
cmap = LinearSegmentedColormap.from_list('blue_indigo', colors, N=256)

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

surf = ax.plot_surface(x, y, z, cmap=cmap, alpha=0.85, linewidth=0.1, edgecolor='#33333312')

ax.set_xlabel('X', fontsize=10, color='#374151', labelpad=10)
ax.set_ylabel('Y', fontsize=10, color='#374151', labelpad=10)
ax.set_zlabel('Z', fontsize=10, color='#374151', labelpad=10)
ax.set_title("Lemniscate Revolution Surface", fontsize=14, color='#1f2937', fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=25, azim=60)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support