In this post we will be generating pie charts in Python using the Matplotlib library. For the purpose of this example our pie chart will consist of six data points which can be seen below.
dataPoints = [12,15,8,22,29,11]
The snippet of code below will generate for us a simple pie chart.
import matplotlib.pyplot as plt
dataPoints = [12,15,8,22,29,11]
plt.pie(dataPoints)
plt.show()
The above would give us the following output.

In the snippet of code below we will be adding labels to the data points within our pie chart.
import matplotlib.pyplot as plt
dataPoints = [12,15,8,22,29,11]
dataLabels = ["Product 1","Product 2","Product 3","Product 4","Product 5","Product 6",]
plt.pie(dataPoints, labels=dataLabels)
plt.show()
The above would give us the following output.
