3D Scatter

Particle Collision Event Display

High-energy particle physics collision event showing particle tracks emanating from collision point.

Output
Particle Collision Event Display
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(2024)

# Simulate particle tracks from collision
n_particles = 200

# Particles emanate from origin with jet structure
phi = np.random.uniform(0, 2*np.pi, n_particles)
theta = np.abs(np.random.normal(0, 0.5, n_particles))  # Forward peaked
momentum = np.random.exponential(2, n_particles)

x = momentum * np.sin(theta) * np.cos(phi)
y = momentum * np.sin(theta) * np.sin(phi)
z = momentum * np.cos(theta) * np.sign(np.random.randn(n_particles))

# Energy for color
energy = np.sqrt(x**2 + y**2 + z**2) + np.random.exponential(0.5, n_particles)

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

scatter = ax.scatter(x, y, z, c=energy, cmap='plasma', s=energy*15, 
                     alpha=0.7, edgecolors='none')

# Mark collision point
ax.scatter([0], [0], [0], c='#fbbf24', s=200, marker='*')

ax.set_xlabel('px (GeV/c)', color='white', fontsize=10)
ax.set_ylabel('py (GeV/c)', color='white', fontsize=10)
ax.set_zlabel('pz (GeV/c)', color='white', fontsize=10)
ax.set_title('Particle Collision Event Display', 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.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support