
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/widgets/cursor.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_cursor.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_widgets_cursor.py:


======
Cursor
======

.. GENERATED FROM PYTHON SOURCE LINES 7-27

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    from matplotlib.widgets import Cursor

    # Fixing random state for reproducibility
    np.random.seed(19680801)

    fig, ax = plt.subplots(figsize=(8, 6))

    x, y = 4*(np.random.rand(2, 100) - .5)
    ax.plot(x, y, 'o')
    ax.set_xlim(-2, 2)
    ax.set_ylim(-2, 2)

    # Set useblit=True on most backends for enhanced performance.
    cursor = Cursor(ax, useblit=True, color='red', linewidth=2)

    plt.show()




.. image-sg:: /gallery/widgets/images/sphx_glr_cursor_001.png
   :alt: cursor
   :srcset: /gallery/widgets/images/sphx_glr_cursor_001.png, /gallery/widgets/images/sphx_glr_cursor_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 28-34

.. admonition:: References

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

   - `matplotlib.widgets.Cursor`


.. _sphx_glr_download_gallery_widgets_cursor.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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