Annotations direct attention. A well-placed label, arrow or reference line tells the viewer exactly what to notice — turning a chart from "here's data" into "here's the point".
Text & arrows
ax.text(2, 8, "peak", fontsize=12) # plain text at (2, 8)ax.annotate("record high", # text + an arrowxy=(x_peak, y_peak), # point to herexytext=(x_peak + 1, y_peak + 2), # place text herearrowprops=dict(arrowstyle="->"))
Reference lines
ax.axhline(y=target, color="grey", linestyle="--", label="target")ax.axvline(x=launch_date, color="red")ax.axhspan(0, 40, alpha=0.1, color="red") # shade a region
Key takeaways
- 01ax.text places plain text; ax.annotate adds text with an arrow pointing at a data point.
- 02axhline/axvline draw reference lines; axhspan/axvspan shade regions.
- 03Annotate the single most important feature — don't clutter.
- 04Reference lines are ideal for targets and thresholds.
