.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "intro/matplotlib/auto_examples/plot_pie.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. 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_intro_matplotlib_auto_examples_plot_pie.py: Pie chart ========= A simple pie chart example with matplotlib. .. GENERATED FROM PYTHON SOURCE LINES 7-23 .. image-sg:: /intro/matplotlib/auto_examples/images/sphx_glr_plot_pie_001.png :alt: plot pie :srcset: /intro/matplotlib/auto_examples/images/sphx_glr_plot_pie_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt n = 20 Z = np.ones(n) Z[-1] *= 2 plt.axes((0.025, 0.025, 0.95, 0.95)) plt.pie(Z, explode=Z * 0.05, colors=[f"{i / float(n):f}" for i in range(n)]) plt.axis("equal") plt.xticks([]) plt.yticks() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.049 seconds) .. _sphx_glr_download_intro_matplotlib_auto_examples_plot_pie.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pie.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pie.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_pie.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_