Home >>Python Programs >Draw a pie chart that shows our daily activity in Python
In this example, we will see a Python program through which we can draw a pie chart that shows our daily activity.
The pie chart represents the quantity given in percentages, and the total sum of all the segments of the pie chart must be equal to 100%. It is used to visualize the given data in the form of a percentage.
In this program, we will use the "matplotlib" library of the Python. matplotlib is one of the most useful libraries of Python. It is used for visualization of given data in 2D plots. Using this, we can also draw plots, pie charts, histograms, scatterplots, etc.
Program:
import matplotlib.pyplot as plt
A=['eat', 'movie', 'study', 'play','daily_work','sleep']
T=[1,3,5,4,2,9]
plt.pie(T, labels=A,autopct= '%1.1f%%')
plt.title('Pie chart of daily activity.')
plt.show()