Data storytelling requires guiding the viewer's attention to peak outliers, regime shifts, or inflection points. `plt.annotate()` anchors an arrow pointing exactly at a data coordinate $(x, y)$ while placing text nearby.
A comic book dialogue balloon with an arrow pointing directly to the speaker.
`xy=(x, y)` is the exact tip of the arrow pointing at the data mark. `xytext=(x, y)` is where the annotation text box is positioned.
ax.annotate('Event', xy=(5, 20), xytext=(6, 25), arrowprops=dict(facecolor='teal'))Avoid the top errors and bad plotting practices that trip up new Python developers
Switch from abstract numbers to relatable Cricket, Cinema & Business charts
Write Matplotlib code to solve the objective and see your live plot render
Plot `x=[1, 2, 3]` and `y=[10, 30, 20]`, annotate the point `xy=(2, 30)` with text 'Max Value' using `plt.annotate()`.
✓ annotate✓ xyTest your understanding to unlock the lesson completion badge