
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/widgets/multicursor.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_widgets_multicursor.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_widgets_multicursor.py:


===========
Multicursor
===========

Showing a cursor on multiple plots simultaneously.

This example generates three Axes split over two different figures.  On
hovering the cursor over data in one subplot, the values of that datapoint are
shown in all Axes.

.. GENERATED FROM PYTHON SOURCE LINES 12-32

.. code-block:: Python


    import matplotlib.pyplot as plt
    import numpy as np

    from matplotlib.widgets import MultiCursor

    t = np.arange(0.0, 2.0, 0.01)
    s1 = np.sin(2*np.pi*t)
    s2 = np.sin(3*np.pi*t)
    s3 = np.sin(4*np.pi*t)

    fig, (ax1, ax2) = plt.subplots(2, sharex=True)
    ax1.plot(t, s1)
    ax2.plot(t, s2)
    fig, ax3 = plt.subplots()
    ax3.plot(t, s3)

    multi = MultiCursor(None, (ax1, ax2, ax3), color='r', lw=1)
    plt.show()




.. rst-class:: sphx-glr-horizontal


    *

      .. image-sg:: /gallery/widgets/images/sphx_glr_multicursor_001.png
         :alt: multicursor
         :srcset: /gallery/widgets/images/sphx_glr_multicursor_001.png, /gallery/widgets/images/sphx_glr_multicursor_001_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /gallery/widgets/images/sphx_glr_multicursor_002.png
         :alt: multicursor
         :srcset: /gallery/widgets/images/sphx_glr_multicursor_002.png, /gallery/widgets/images/sphx_glr_multicursor_002_2_00x.png 2.00x
         :class: sphx-glr-multi-img





.. GENERATED FROM PYTHON SOURCE LINES 33-39

.. admonition:: References

   The use of the following functions, methods, classes and modules is shown
   in this example:

   - `matplotlib.widgets.MultiCursor`


.. _sphx_glr_download_gallery_widgets_multicursor.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

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

    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: multicursor.zip <multicursor.zip>`


.. only:: html

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

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