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

    Click :ref:`here <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`.


.. image:: /examples/images/sphx_glr_highlight_001.png
    :class: sphx-glr-single-img





.. code-block:: default


    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
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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