Calendar Heatmap
Chart overview
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.
Key points
- 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
.png&w=1920&q=75)
Create This Chart Now
Generate publication-ready calendar heatmaps with AI in seconds. No coding required – just describe your data and let AI do the work.
View example prompt
"Create a GitHub-style calendar heatmap showing daily 'Step Count' activity for the entire year 2023. Generate realistic fitness data with weekly patterns (higher on weekdays, lower weekends), seasonal variation (more active in spring/summer), and occasional rest days (zero steps). Use the YlOrRd (Yellow-Orange-Red) colormap with white for zero/missing days. Display all 12 months in a horizontal layout with month labels. Add a color legend showing step ranges (0, 5K, 10K, 15K+). Annotate the highest-activity day with a marker. Include summary statistics: total steps, average daily steps, longest streak, and best month."
How to create this chart in 30 seconds
Upload Data
Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.
AI Generation
Our AI analyzes your data and generates the Calendar Heatmap code automatically.
Customize & Export
Tweak the design with natural language, then export as high-res PNG, SVG or PDF.
Python Code Example
import calmap
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# === USER-EDITABLE PARAMETERS ===
# (Add any user-specific parameters here if needed)
# Initialize df to None if not already defined
df = None
try:
df
except NameError:
pass # df remains None if not defined
# Check if a DataFrame `df` is provided; otherwise generate example data
if 'df' in locals() and isinstance(df, pd.DataFrame):
# Expect df to have columns 'date' and 'steps'
if 'date' in df.columns and 'steps' in df.columns:
dates = pd.to_datetime(df['date'])
steps = df['steps'].values
else:
# Fallback to first two columns
dates = pd.to_datetime(df.iloc[:, 0])
steps = df.iloc[:, 1].values
else:
# 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()
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:,}")
# Optional: Highlight best and worst days
best_day = data.idxmax()
worst_day = data.idxmin()
print(f"Best day: {best_day.date()} ({data[best_day]:,})")
print(f"Worst day: {worst_day.date()} ({data[worst_day]:,})")
# Create figure and axis with desired size first
fig, ax = plt.subplots(figsize=(12, 8))
# Create calendar heatmap
calmap.yearplot(
data,
cmap='YlOrRd',
daylabels=['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
ax=ax
)
# Add clear title closer to calendar
fig.suptitle("Daily Step Count Heatmap for 2023", fontsize=16, y=0.90)
# Add annotation box with statistics, moved up
info_text = (
f"Avg: {avg_steps:,.0f}\n"
f"Total: {total_steps:,.0f}\n"
f"Max: {max_steps:,} ({best_day.date()})\n"
f"Min: {min_steps:,} ({worst_day.date()})"
)
ax.text(
0.02, 1.6, info_text,
transform=ax.transAxes,
fontsize=10,
verticalalignment='top',
horizontalalignment='left',
bbox=dict(boxstyle='round', facecolor='#f0f0f0', alpha=0.8)
)
# Ensure colorbar exists and configure it properly
try:
images = ax.get_images()
if images:
im = images[0]
cbar = fig.colorbar(im, ax=ax, orientation='horizontal', pad=0.02)
cbar.set_label('Step Count', fontsize=12)
cbar.ax.tick_params(labelsize=10)
except Exception as e:
print(f"Note: Could not create colorbar ({e})")
# Improved layout: adjusted margins to accommodate moved annotation
plt.subplots_adjust(top=0.93, bottom=0.55, left=0.03, right=0.88)
# Save and display the figure
plt.savefig('daily_step_count_heatmap_2023.png', dpi=300, bbox_inches='tight', facecolor='white')
plt.show()
# END-OF-CODEOpens the Analyze page with this code pre-loaded and ready to execute
Console 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
Scientific Chart Selection Cheat Sheet
Not sure whether to use a Violin Plot, Box Plot, or Ridge Plot? Download our single-page reference mapping the most-used scientific chart types, exactly when to use them, and the core Matplotlib/Seaborn functions.