Event Plot
Particle Detector Events
LHC-style multi-layer collision detection
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Simulate particle detector events
np.random.seed(42)
detectors = ['Tracker', 'ECAL', 'HCAL', 'Muon Chamber', 'Forward']
collision_times = [
np.sort(np.random.exponential(0.00001, 500).cumsum() * 1e6), # microseconds
np.sort(np.random.exponential(0.00002, 300).cumsum() * 1e6),
np.sort(np.random.exponential(0.00003, 200).cumsum() * 1e6),
np.sort(np.random.exponential(0.00005, 100).cumsum() * 1e6),
np.sort(np.random.exponential(0.00004, 150).cumsum() * 1e6),
]
# CERN-inspired colors
colors = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6']
# Create figure
fig, ax = plt.subplots(figsize=(12, 6), facecolor='#0F172A')
ax.set_facecolor('#0F172A')
for i, (times, color) in enumerate(zip(collision_times, colors)):
visible = times[times <= 100]
# Particle shower effect
ax.eventplot(visible, lineoffsets=i, linelengths=0.5, linewidths=0.5,
colors=color, alpha=0.6)
# Bunch crossing markers
for bc in np.arange(0, 100, 25):
ax.axvline(bc, color='#FBBF24', linewidth=1, linestyle=':', alpha=0.5)
# Event of interest
ax.axvspan(45, 55, color='#DC2626', alpha=0.1, zorder=0)
ax.text(50, 4.7, 'Higgs Candidate', ha='center', fontsize=10,
color='#DC2626', fontweight='bold')
# Styling
ax.set_yticks(range(len(detectors)))
ax.set_yticklabels(detectors, fontsize=11, fontweight='500', color='white')
ax.set_xlabel('Time (μs)', fontsize=12, fontweight='500', color='#94A3B8')
ax.set_xlim(0, 100)
ax.set_ylim(-0.5, len(detectors) - 0.5)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#334155')
ax.spines['bottom'].set_color('#334155')
ax.tick_params(colors='#94A3B8', labelsize=10)
ax.xaxis.grid(True, linestyle='--', alpha=0.15, color='#475569')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Event Plot examples
☕