3D Line
Expanding Spiral Galaxy Arm
A 3D expanding spiral resembling a galaxy arm with a green to cyan color gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Expanding spiral (galaxy-like)
n = 500
t = np.linspace(0, 8 * np.pi, n)
# Radius expands with t
r = 0.1 + 0.1 * t
x = r * np.cos(t)
y = r * np.sin(t)
z = 0.05 * t * np.sin(t * 0.5) # Slight z-wave
# Color gradient along the spiral
colors = np.linspace(0, 1, n)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
# Create segments with color gradient
for i in range(n-1):
color_val = colors[i]
# Green to cyan gradient
r_col = int(34 + (6 - 34) * color_val)
g_col = int(197 + (182 - 197) * color_val)
b_col = int(94 + (212 - 94) * color_val)
color = f'#{r_col:02x}{g_col:02x}{b_col:02x}'
ax.plot(x[i:i+2], y[i:i+2], z[i:i+2], color=color, linewidth=2)
# Add glow effect
ax.plot(x, y, z, color='#22c55e', linewidth=4, alpha=0.15)
ax.set_xlim(-3, 3)
ax.set_ylim(-3, 3)
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('Expanding Spiral Galaxy Arm', 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=35, azim=60)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Line examples
☕