In [117]: import matplotlib.pyplot as plt
In [118]: data = [5,25,50,20]
plt.pie(data)
plt.show()
4 Using custom colors for pie charts
In [29]: import numpy as np
import matplotlib.pyplot as plt
In [35]: values = np.random.rand(8)#generating 8 numbers with 0<=values<1
color_set = ('.00', '.25', '.50', '.75')
#If there are less colors than values, then pyplot.pie() will simply cycle through the color li
#each color will be used twice.in our example
In [37]: plt.pie(values, colors=color_set)
plt.show()