A pie plot is a circular graph that is split up into wedge-shaped pieces. Each piece is proportionate to the value it represents. The total value of the pie is 100 percent:
# Add the essential library matplotlib
import matplotlib.pyplot as plt
# create the data
subjects = ["Mathematics","Science","Communication Skills","Computer Application"]
scores = [85,62,57,92]
# Plot the pie plot
plt.pie(scores,
labels=subjects,
colors=['r','g','b','y'],
startangle=90,
shadow= True,
explode=(0,0.1,0,0),
autopct='%1.1f%%')
# Add title to graph
plt.title("Student Performance")
# Draw the chart
plt.show()
This results in the following output:
In the preceding code of the pie chart, we specified values, labels, colors, startangle, shadow, explode, and autopct. In our example, values is the scores of the student in four subjects and labels is the list of subject...