annotate()

noun

say it: “AN-oh-tayt” /ˈænoʊˌteɪt/

A matplotlib method that writes a short note on a chart with an arrow pointing to one point.

What does annotate() do in matplotlib?

annotate() is the matplotlib Axes method that writes a short note on a chart, with an arrow pointing at the one value that matters. xy= is the point the arrow touches and xytext= is where the words sit.

ax.annotate("Curbside pickup begins",
            xy=(pd.Timestamp("2025-01-01"), monthly.loc["2025-01-01"]),
            xytext=(pd.Timestamp("2024-03-01"), 280),
            arrowprops={"arrowstyle": "->"})

In a sentence

  • “annotate() placed the note away from the line so it didn't cover it.”
  • “She used annotate() to point an arrow at January, when pickup began.”

Level: Journeyman · More Python terms at this level

Updated