Matplotlib and seaborn 3 · Layout and styling

Annotate a point

Add a label with an arrow pointing at a data point.

fig, ax = plt.subplots()
ax.plot(x, np.sin(x))
ax.annotate("peak", xy=(np.pi / 2, 1), xytext=(3, 0.5), arrowprops={"arrowstyle": "->"})

Official Matplotlib and seaborn 3 documentation

More layout and styling commands

All layout and styling commands · Matplotlib and seaborn 3 cheatsheet

Was this page helpful?