

.. _sphx_glr_gallery_shapes_and_collections_scatter.py:


============
Scatter plot
============

This example showcases a simple scatter plot.




.. image:: /gallery/shapes_and_collections/images/sphx_glr_scatter_001.png
    :align: center





.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt

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


    N = 50
    x = np.random.rand(N)
    y = np.random.rand(N)
    colors = np.random.rand(N)
    area = np.pi * (15 * np.random.rand(N))**2  # 0 to 15 point radii

    plt.scatter(x, y, s=area, c=colors, alpha=0.5)
    plt.show()

**Total running time of the script:** ( 0 minutes  0.052 seconds)



.. 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>`_
