Effective Chart Annotations
Annotations guide viewers to insights and add crucial context. Strategic text, arrows, and highlights turn charts into stories, making key findings immediately obvious.
Types of Annotations
1. Text Annotations
import matplotlib.pyplot as plt
plt.plot(months, sales)
# Add text annotation
plt.annotate('Product launch',
xy=(6, 15000), # Point to annotate
xytext=(7, 17000), # Label position
arrowprops=dict(arrowstyle='->', color='red'))
plt.show()
2. Highlight Key Areas
# Shade important period
plt.axvspan(6, 8, alpha=0.2, color='yellow', label='Peak Season')
3. Reference Lines
# Add target or threshold line
plt.axhline(y=10000, color='red', linestyle='--', label='Target')
# Add vertical line for event
plt.axvline(x=6, color='green', linestyle=':', label='Campaign Start')
Best Practices
Do:
- Explain "why" something happened
- Highlight the insight, not obvious patterns
- Use consistent style
- Keep text concise
- Position labels to avoid overlaps
Don't:
- Annotate every data point
- State the obvious ("This line goes up")
- Use tiny font sizes
- Clutter the chart
- Cover data with annotations
Effective Annotation Examples
Example 1: Sales Chart
plt.plot(dates, revenue)
# Good annotation - explains WHY
plt.annotate('Black Friday promotion\ndrove 40% revenue spike',
xy=('2024-11-24', 50000),
xytext=('2024-12-01', 55000),
bbox=dict(boxstyle='round', fc='wheat', alpha=0.8),
arrowprops=dict(arrowstyle='->', lw=1.5))
# Bad annotation - states obvious
# "Revenue increased" ← viewer can see this!
Example 2: Performance Trend
# Highlight anomaly
plt.scatter(dates, values)
plt.annotate('System outage\ncaused data gap',
xy=('2024-08-15', 0),
xytext=('2024-08-20', 500),
arrowprops=dict(arrowstyle='->', color='red', lw=2))
When to Annotate
- Anomalies or outliers
- Inflection points
- Key events (product launches, campaigns)
- Targets or thresholds crossed
- Important context not obvious from data
Pro Tip: Annotations should explain WHY, not just describe WHAT. Don't say "Sales increased"—say "New marketing campaign drove 40% growth." Less is more—only annotate insights that aren't immediately obvious!
← Back to Visualization Tips