.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/shapes_and_collections/scatter.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_shapes_and_collections_scatter.py: ============ Scatter plot ============ This example showcases a simple scatter plot. .. GENERATED FROM PYTHON SOURCE LINES 8-24 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np # 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 = (30 * np.random.rand(N))**2 # 0 to 15 point radii plt.scatter(x, y, s=area, c=colors, alpha=0.5) plt.show() .. image-sg:: /gallery/shapes_and_collections/images/sphx_glr_scatter_001.png :alt: scatter :srcset: /gallery/shapes_and_collections/images/sphx_glr_scatter_001.png, /gallery/shapes_and_collections/images/sphx_glr_scatter_001_2_00x.png 2.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 25-31 .. admonition:: References The use of the following functions, methods, classes and modules is shown in this example: - `matplotlib.axes.Axes.scatter` / `matplotlib.pyplot.scatter` .. _sphx_glr_download_gallery_shapes_and_collections_scatter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: scatter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: scatter.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_