

.. _sphx_glr_examples_scatter.py:


Scatter plots are highlighted point-by-point.
=============================================

... as opposed to lines with a ``"."`` style, which have the same appearance,
but are highlighted as a whole.




.. image:: /examples/images/sphx_glr_scatter_001.png
    :align: center





.. code-block:: python


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

    x, y, z = np.random.random((3, 10))
    fig, axs = plt.subplots(3)
    fig.suptitle("Highlighting affects individual points\n"
                 "only in scatter plots (top two axes)")
    axs[0].scatter(x, y, c=z, s=100 * np.random.random(10))
    axs[1].scatter(x, y)
    axs[2].plot(x, y, "o")
    mplcursors.cursor(highlight=True)
    plt.show()



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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