import matplotlib.pyplot as plt
from matplotlib import cm
a = np.random.random(40)
cs = cm.Set1(np.arange(40) / 40.0)
f = plt.figure()
ax = f.add_subplot(111, aspect='equal')
p = plt.pie(a, colors=cs)
plt.show()
How can I generate more colors on pie chart matplotlib