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

    Click :ref:`here <sphx_glr_download_gallery_pie_and_polar_charts_polar_demo.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_pie_and_polar_charts_polar_demo.py:


==========
Polar Demo
==========

Demo of a line plot on a polar axis.



.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt


    r = np.arange(0, 2, 0.01)
    theta = 2 * np.pi * r

    ax = plt.subplot(111, projection='polar')
    ax.plot(theta, r)
    ax.set_rmax(2)
    ax.set_rticks([0.5, 1, 1.5, 2])  # Less radial ticks
    ax.set_rlabel_position(-22.5)  # Move radial labels away from plotted line
    ax.grid(True)

    ax.set_title("A line plot on a polar axis", va='bottom')
    plt.show()




.. image:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_demo_001.png
    :class: sphx-glr-single-img




------------

References
""""""""""

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



.. code-block:: python


    import matplotlib
    matplotlib.axes.Axes.plot
    matplotlib.projections.polar
    matplotlib.projections.polar.PolarAxes
    matplotlib.projections.polar.PolarAxes.set_rticks
    matplotlib.projections.polar.PolarAxes.set_rmax
    matplotlib.projections.polar.PolarAxes.set_rlabel_position







.. _sphx_glr_download_gallery_pie_and_polar_charts_polar_demo.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
