You are reading an old version of the documentation (v2.1.1). For the latest version see https://matplotlib.org/stable/gallery/pyplots/annotation_basic.html
matplotlib
Fork me on GitHub


Travis-CI:

Related Topics

This Page

Annotation BasicΒΆ

../../_images/sphx_glr_annotation_basic_001.png
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = ax.plot(t, s, lw=2)

ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
            arrowprops=dict(facecolor='black', shrink=0.05),
            )

ax.set_ylim(-2,2)
plt.show()

Total running time of the script: ( 0 minutes 0.017 seconds)

Gallery generated by Sphinx-Gallery