3D Fill Between
3D Particle Accelerator Beam
Physics visualization of particle beam trajectory in an accelerator with neon glow effect.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(12, 9), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d')
ax.set_facecolor('#0a0a0f')
n = 400
t = np.linspace(0, 12*np.pi, n)
z = np.linspace(0, 8, n)
# Oscillating beam with decay
amplitude = np.exp(-z/6)
x_main = amplitude * np.sin(t)
y_main = amplitude * np.cos(t)
x_outer = 1.3 * amplitude * np.sin(t + 0.1)
y_outer = 1.3 * amplitude * np.cos(t + 0.1)
# Main beam with glow
ax.plot(x_main, y_main, z, linewidth=3, color='#6CF527')
ax.plot(x_outer, y_outer, z, linewidth=1.5, color='#27D3F5', alpha=0.6)
# Energy field
for i in range(0, n, 6):
ax.plot([x_main[i], x_outer[i]], [y_main[i], y_outer[i]], [z[i], z[i]],
color='#F5276C', alpha=0.2, linewidth=0.5)
ax.set_xlabel('X', fontsize=11, color='white')
ax.set_ylabel('Y', fontsize=11, color='white')
ax.set_zlabel('Z (beam path)', fontsize=11, color='white')
ax.set_title('Particle Beam Trajectory', fontsize=14, color='white', fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#333333')
ax.yaxis.pane.set_edgecolor('#333333')
ax.zaxis.pane.set_edgecolor('#333333')
ax.grid(True, alpha=0.3, color='#555555')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Fill Between examples
☕