

.. _sphx_glr_gallery_pylab_examples_polar_demo.py:


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

Demo of a line plot on a polar axis.




.. image:: /gallery/pylab_examples/images/sphx_glr_polar_demo_001.png
    :align: center





.. 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)  # get radial labels away from plotted line
    ax.grid(True)

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

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



.. container:: sphx-glr-footer


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

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

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