Pie chartΒΆ

A simple pie chart example with matplotlib.

../../../_images/plot_pie_ex_1.png

Python source code: plot_pie_ex.py

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*.05, colors = ['%f' % (i/float(n)) for i in range(n)])
plt.axis('equal')
plt.xticks(())
plt.yticks()
plt.show()

Total running time of the example: 0.06 seconds ( 0 minutes 0.06 seconds)