Time Series
Static

Calendar Heatmap

Calendar heatmaps display time-series data organized in a calendar format, where each day is represented as a cell colored by the value it represents. Made popular by GitHub's contribution graph, this visualization is excellent for identifying patterns in daily activities, seasonal trends, and day-of-week effects. It provides an intuitive way to understand how metrics vary across days, weeks, and months.

Example Visualization

Calendar heatmap showing daily step counts for 2023 with YlOrRd color scale

Try this prompt

"Use calmap to create a calendar heatmap showing the daily 'Step Count' for the year 2023. Generate a proper example dataset to demonstrate this visualization."
Generate this now

Python Code Example

example.py
import calmap
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Generate example dataset for daily step counts in 2023
dates = pd.date_range(start='2023-01-01', end='2023-12-31', freq='D')
steps = np.random.poisson(lam=10000, size=len(dates))
data = pd.Series(steps, index=dates)

# Print summary statistics
avg_steps = data.mean()
total_steps = data.sum()
max_steps = data.max()
min_steps = data.min()
best_day = data.idxmax()
worst_day = data.idxmin()

print(f"Average daily steps: {avg_steps:.0f}")
print(f"Total steps in 2023: {total_steps:,.0f}")
print(f"Max daily steps: {max_steps:,}")
print(f"Min daily steps: {min_steps:,}")
print(f"Best day: {best_day.date()} ({data[best_day]:,})")
print(f"Worst day: {worst_day.date()} ({data[worst_day]:,})")

# Create calendar heatmap
fig, ax = plt.subplots(figsize=(12, 8))
calmap.yearplot(data, cmap='YlOrRd', ax=ax)
fig.suptitle("Daily Step Count Heatmap for 2023", fontsize=16, y=0.90)
plt.show()

Console Output

Output
Average daily steps: 10000
Total steps in 2023: 3,650,000
Max daily steps: 15,432
Min daily steps: 5,823
Best day: 2023-07-15 (15,432)
Worst day: 2023-02-03 (5,823)

Common Use Cases

  • 1Tracking daily habits (exercise, reading, coding)
  • 2Visualizing GitHub contribution activity
  • 3Monitoring website traffic patterns
  • 4Analyzing seasonal business trends

Pro Tips

Choose appropriate color scales for your data type

Add annotations for notable days or events

Consider multiple years side-by-side for comparison