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

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

.. _sphx_glr_gallery_pie_and_polar_charts_polar_legend.py:


============
Polar Legend
============

Demo of a legend on a polar-axis plot.



.. code-block:: python


    import matplotlib.pyplot as plt
    import numpy as np

    # radar green, solid grid lines
    plt.rc('grid', color='#316931', linewidth=1, linestyle='-')
    plt.rc('xtick', labelsize=15)
    plt.rc('ytick', labelsize=15)

    # force square figure and square axes looks better for polar, IMO
    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8],
                      projection='polar', facecolor='#d5de9c')

    r = np.arange(0, 3.0, 0.01)
    theta = 2 * np.pi * r
    ax.plot(theta, r, color='#ee8d18', lw=3, label='a line')
    ax.plot(0.5 * theta, r, color='blue', ls='--', lw=3, label='another line')
    ax.legend()

    plt.show()




.. image:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_legend_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.axes.Axes.legend
    matplotlib.projections.polar
    matplotlib.projections.polar.PolarAxes







.. _sphx_glr_download_gallery_pie_and_polar_charts_polar_legend.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: polar_legend.ipynb <polar_legend.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>`_
