
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/pie_and_polar_charts/polar_scatter.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

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

        :ref:`Go to the end <sphx_glr_download_gallery_pie_and_polar_charts_polar_scatter.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_pie_and_polar_charts_polar_scatter.py:


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

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

.. GENERATED FROM PYTHON SOURCE LINES 9-26

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    # 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

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




.. image-sg:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_001.png
   :alt: polar scatter
   :srcset: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_001.png, /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 27-33

Scatter plot on polar axis, with offset origin
----------------------------------------------

The main difference with the previous plot is the configuration of the origin
radius, producing an annulus. Additionally, the theta zero location is set to
rotate the plot.

.. GENERATED FROM PYTHON SOURCE LINES 33-41

.. code-block:: Python


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

    ax.set_rorigin(-2.5)
    ax.set_theta_zero_location('W', offset=10)




.. image-sg:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_002.png
   :alt: polar scatter
   :srcset: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_002.png, /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_002_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 42-47

Scatter plot on polar axis confined to a sector
-----------------------------------------------

The main difference with the previous plots is the configuration of the
theta start and end limits, producing a sector instead of a full circle.

.. GENERATED FROM PYTHON SOURCE LINES 47-57

.. code-block:: Python


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

    ax.set_thetamin(45)
    ax.set_thetamax(135)

    plt.show()




.. image-sg:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_003.png
   :alt: polar scatter
   :srcset: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_003.png, /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_003_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 58-75

.. admonition:: References

   The use of the following functions, methods, classes and modules is shown
   in this example:

   - `matplotlib.axes.Axes.scatter` / `matplotlib.pyplot.scatter`
   - `matplotlib.projections.polar`
   - `matplotlib.projections.polar.PolarAxes.set_rorigin`
   - `matplotlib.projections.polar.PolarAxes.set_theta_zero_location`
   - `matplotlib.projections.polar.PolarAxes.set_thetamin`
   - `matplotlib.projections.polar.PolarAxes.set_thetamax`

.. tags::

   plot-style: polar
   plot-style: scatter
   level: beginner


.. _sphx_glr_download_gallery_pie_and_polar_charts_polar_scatter.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

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

    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: polar_scatter.zip <polar_scatter.zip>`


.. only:: html

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

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