3D Line

Spherical Helix

A helix curve constrained to the surface of a sphere, creating a beautiful 3D pattern in cyan.

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

# Spherical helix - helix on a sphere surface
n = 500
t = np.linspace(0, 20 * np.pi, n)

# Parametric equations for spherical helix
phi = t
theta = np.pi/2 * np.sin(t/10)

x = np.cos(phi) * np.cos(theta)
y = np.sin(phi) * np.cos(theta)
z = np.sin(theta)

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

# Glow effect
ax.plot(x, y, z, color='#06b6d4', linewidth=4, alpha=0.2)
ax.plot(x, y, z, color='#22d3ee', linewidth=2)
ax.plot(x, y, z, color='#67e8f9', linewidth=0.8)

ax.set_xlim(-1.2, 1.2)
ax.set_ylim(-1.2, 1.2)
ax.set_zlim(-1.2, 1.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('Spherical 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=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