.. 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_bar.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_pie_and_polar_charts_polar_bar.py: ======================= Bar chart on polar axis ======================= Demo of bar plot on a polar axis. .. GENERATED FROM PYTHON SOURCE LINES 8-26 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np # Fixing random state for reproducibility np.random.seed(19680801) # Compute pie slices N = 20 theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False) radii = 10 * np.random.rand(N) width = np.pi / 4 * np.random.rand(N) colors = plt.cm.viridis(radii / 10.) ax = plt.subplot(projection='polar') ax.bar(theta, radii, width=width, bottom=0.0, color=colors, alpha=0.5) plt.show() .. image-sg:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_bar_001.png :alt: polar bar :srcset: /gallery/pie_and_polar_charts/images/sphx_glr_polar_bar_001.png, /gallery/pie_and_polar_charts/images/sphx_glr_polar_bar_001_2_00x.png 2.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 27-34 .. admonition:: References The use of the following functions, methods, classes and modules is shown in this example: - `matplotlib.axes.Axes.bar` / `matplotlib.pyplot.bar` - `matplotlib.projections.polar` .. _sphx_glr_download_gallery_pie_and_polar_charts_polar_bar.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: polar_bar.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: polar_bar.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_