

.. _sphx_glr_gallery_pyplots_pyplot_annotate.py:


===============
Pyplot Annotate
===============





.. image:: /gallery/pyplots/images/sphx_glr_pyplot_annotate_001.png
    :align: center





.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt

    ax = plt.subplot(111)

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

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

    plt.ylim(-2,2)
    plt.show()

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



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: pyplot_annotate.py <pyplot_annotate.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: pyplot_annotate.ipynb <pyplot_annotate.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
