Event Plot

Wildlife Migration Patterns

Seasonal migration tracking for various species

Output
Wildlife Migration Patterns
Python
import matplotlib.pyplot as plt
import numpy as np

# Simulate wildlife tracking events
np.random.seed(42)
species = ['Arctic Tern', 'Monarch Butterfly', 'Caribou', 'Gray Whale', 'Wildebeest']
# Migration checkpoints over 12 months
migrations = [
    np.array([1, 2, 3, 9, 10, 11]),           # Arctic Tern
    np.array([3, 4, 9, 10]),                   # Monarch
    np.array([4, 5, 9, 10]),                   # Caribou
    np.array([1, 2, 3, 10, 11, 12]),          # Gray Whale
    np.array([6, 7, 11, 12, 1]),               # Wildebeest
]

# Nature colors
colors = ['#0EA5E9', '#F97316', '#78716C', '#6366F1', '#84CC16']

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

for i, (events, color) in enumerate(zip(migrations, colors)):
    # Each event is a month, make wider markers
    ax.eventplot(events, lineoffsets=i, linelengths=0.6, linewidths=8,
                 colors=color, alpha=0.7)
    ax.eventplot(events, lineoffsets=i, linelengths=0.4, linewidths=3,
                 colors='white', alpha=0.5)

# Season bands
seasons = [(1, 3, '#DBEAFE', 'Winter'), (4, 6, '#DCFCE7', 'Spring'),
           (7, 9, '#FEF3C7', 'Summer'), (10, 12, '#FFEDD5', 'Fall')]
for start, end, color, name in seasons:
    ax.axvspan(start - 0.5, end + 0.5, color=color, alpha=0.4, zorder=0)
    ax.text((start + end) / 2, 4.8, name, ha='center', fontsize=10, 
            color='#6B7280', fontweight='500')

# Styling
ax.set_yticks(range(len(species)))
ax.set_yticklabels(species, fontsize=11, fontweight='500', color='#374151')
ax.set_xlabel('Month', fontsize=12, fontweight='500', color='#374151')
ax.set_xticks(range(1, 13))
ax.set_xticklabels(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], fontsize=9)
ax.set_xlim(0.5, 12.5)
ax.set_ylim(-0.5, len(species) - 0.5)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#D1D5DB')
ax.spines['bottom'].set_color('#D1D5DB')
ax.tick_params(colors='#6B7280', labelsize=10)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support