Event Plot

Seismic Event Timeline

Earthquake occurrences by tectonic region over a year

Output
Seismic Event Timeline
Python
import matplotlib.pyplot as plt
import numpy as np

# Simulate seismic events by region
np.random.seed(42)
regions = ['Pacific Ring', 'Mediterranean', 'Himalayan', 'Mid-Atlantic', 'Caribbean']
magnitudes_base = [5.5, 4.5, 5.0, 4.0, 4.8]

events = []
for mag in magnitudes_base:
    n_events = int(np.random.uniform(20, 50))
    times = np.sort(np.random.uniform(0, 365, n_events))
    events.append(times)

# Magnitude-based colors
colors = ['#DC2626', '#F97316', '#EAB308', '#22C55E', '#3B82F6']

# Create figure
fig, ax = plt.subplots(figsize=(12, 6), facecolor='#FFFBEB')
ax.set_facecolor('#FFFBEB')

for i, (ev, color, mag) in enumerate(zip(events, colors, magnitudes_base)):
    # Line width based on magnitude
    lw = 1 + (mag - 4) * 0.8
    ax.eventplot(ev, lineoffsets=i, linelengths=0.5, linewidths=lw,
                 colors=color, alpha=0.85)

# Monthly grid
for month in range(0, 365, 30):
    ax.axvline(month, color='#D6D3D1', linewidth=0.5, alpha=0.5)

# Labels
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
ax.set_xticks([15 + i*30 for i in range(12)])
ax.set_xticklabels(months, fontsize=9)

# Styling
ax.set_yticks(range(len(regions)))
ax.set_yticklabels(regions, fontsize=11, fontweight='500', color='#44403C')
ax.set_xlabel('2024', fontsize=12, fontweight='600', color='#44403C')
ax.set_xlim(0, 365)
ax.set_ylim(-0.5, len(regions) - 0.5)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#D6D3D1')
ax.spines['bottom'].set_color('#D6D3D1')
ax.tick_params(colors='#78716C', labelsize=10)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support