Python Code to Draw a Pie Chart

Python code to draw a pie chart; Through this tutorial, i am going to show you how to make pie chart in python using Matplotlib pie chart.

Python Code to Draw a Pie Chart

  1. Import pyplot module from the matplotlib library.
  2. Take the daily activity and time taken to do the activity in two arrays.
  3. Finally, draw the pie chart with the title ‘Activity Chart’.
# Python Program to Draw a Pie Chart
import matplotlib.pyplot as plt
A=['eat', 'movie', 'study', 'play','daily_work','sleep']
plt.pie(T, labels=A,autopct= '%1.1f%%')
plt.title('Activity Chart.')

Recommended Python Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *