Here, we are actualizing a python program to make a pie-talk utilizing matplotlib.pyplot.
Issue proclamation: Create pie-outlines in python (utilizing matplotlib.pyplot).
Program:
import matplotlib.pyplot as plt
days = [1, 2, 3, 4, 5]
slices = [7,2,2,13]
cols = ['r','y','g','b']
my_labels = ["Sleeping ", "Eating", "Working", "Playing"]
plt.pie(slices,
labels=my_labels,
colors = cols,
startangle=45,
explode =(0,0.2,0,0),
shadow = True,
autopct = '%1.1f%%')
plt.axis('equal')
plt.legend(loc=3)
plt.show()
Output:
Clarification:
The pie work plots the pie outline. Mylabels ascribe is given to the name of the pie work. Detonate credit is utilized to detonate the piece of the pie. There is additionally a shadow characteristic in the pie work for giving a shadow impact.
In legend work, a loc variable is passed to indicate the area of the legend.