

.. _sphx_glr_gallery_pie_and_polar_charts_polar_scatter.py:


==========================
Scatter plot on polar axis
==========================

Demo of scatter plot on a polar axis.

Size increases radially in this example and color increases with angle
(just to verify the symbols are being scattered correctly).




.. image:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_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)

    # Compute areas and colors
    N = 150
    r = 2 * np.random.rand(N)
    theta = 2 * np.pi * np.random.rand(N)
    area = 200 * r**2
    colors = theta

    ax = plt.subplot(111, projection='polar')
    c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

    plt.show()

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



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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

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

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