You are reading an old version of the documentation (v3.1.1). For the latest version see https://matplotlib.org/stable/gallery/userdemo/annotate_simple_coord02.html
Version 3.1.2
matplotlib
Fork me on GitHub

Related Topics

Annotate Simple Coord02ΒΆ

../../_images/sphx_glr_annotate_simple_coord02_001.png
import matplotlib.pyplot as plt


fig, ax = plt.subplots(figsize=(3, 2))
an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data",
                  va="center", ha="center",
                  bbox=dict(boxstyle="round", fc="w"))

an2 = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=an1,
                  xytext=(0.5, 1.1), textcoords=(an1, "axes fraction"),
                  va="bottom", ha="center",
                  bbox=dict(boxstyle="round", fc="w"),
                  arrowprops=dict(arrowstyle="->"))

fig.subplots_adjust(top=0.83)
plt.show()

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery