3D Line

Toroidal Helix

A helix wound around a torus (donut) surface, creating a complex interweaving pattern in electric blue.

Output
Toroidal Helix
Python
import matplotlib.pyplot as plt
import numpy as np

# Helix on a torus surface
n = 1000
t = np.linspace(0, 20 * np.pi, n)

# Torus parameters
R = 2  # Major radius
r = 0.8  # Minor radius
p = 5  # Number of winds

# Parametric equations
x = (R + r * np.cos(p * t)) * np.cos(t)
y = (R + r * np.cos(p * t)) * np.sin(t)
z = r * np.sin(p * t)

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

# Electric blue glow
ax.plot(x, y, z, color='#3b82f6', linewidth=4, alpha=0.2)
ax.plot(x, y, z, color='#60a5fa', linewidth=2)
ax.plot(x, y, z, color='#93c5fd', linewidth=0.8)

ax.set_xlim(-4, 4)
ax.set_ylim(-4, 4)
ax.set_zlim(-2, 2)

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('Toroidal Helix', 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.grid(True, alpha=0.2, color='#334155')

ax.view_init(elev=30, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support