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

.. only:: html

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

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

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

.. _sphx_glr_examples_highlight.py:


Highlighting the artist upon selection
======================================

Just pass ``highlight=True`` to `cursor`.

.. GENERATED FROM PYTHON SOURCE LINES 7-25



.. image-sg:: /examples/images/sphx_glr_highlight_001.png
   :alt: highlight
   :srcset: /examples/images/sphx_glr_highlight_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import numpy as np
    import matplotlib.pyplot as plt
    import mplcursors

    x = np.linspace(0, 10, 100)

    fig, ax = plt.subplots()

    # Plot a series of lines with increasing slopes.
    lines = []
    for i in range(1, 20):
        line, = ax.plot(x, i * x, label=f"$y = {i}x$")
        lines.append(line)

    mplcursors.cursor(lines, highlight=True)

    plt.show()


.. _sphx_glr_download_examples_highlight.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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