Friday, December 27, 2024
Google search engine
HomeLanguagesPython Program to Draw a Pie Chart

Python Program to Draw a Pie Chart

Pie chart in python with percentages; In this tutorial, you will learn how to draw a pie chart that shows our daily activity in Python program.

Python Program to Draw a Pie Chart

  • Algorithm to Draw Pie Chart In python
  • Python Program to Draw a Pie Chart

Algorithm to Draw Pie Chart In python

  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

# Python Program to Draw a Pie Chart

import matplotlib.pyplot as plt

A=['eat', 'movie', 'study', 'play','daily_work','sleep']
T=[2,4,6,7,8,9]
 
plt.pie(T, labels=A,autopct= '%1.1f%%')
plt.title('Activity Chart.')
plt.show()

Output

Recommended Python Programs

  1. Python Program to Add Two Numbers
  2. Python Program to Find/Calculate Sum of n Numbers
  3. Python Program to Find/Calculate Average of 3, 4, 5…n numbers
  4. Python Program to Print ASCII Value of Character
  5. Write a Program to Calculate Simple Interest in Python
  6. Python Program to Compute Compound Interest
  7. Leap Year Program in Python
  8. Python Program to Print Star Pattern
  9. Number Pattern Programs in Python
  10. Python Program to Print Even and Odd numbers From 1 to N
  11. How to Find Square of Number in Python
  12. Python Program to Calculate Cube of Number
  13. Python Program to Find LCM of Two Numbers
  14. BMI (Body Mass Index) Calculator in Python
  15. Palindrome Program in Python using while loop, Function, etc
  16. Python: Program to Count Total Number of Bits in Number
  17. Python Random Number Generator Code
  18. Python Program to Calculate n-th term of a Fibonacci Series
  19. Zip Zap Zoom Python Program
  20. Python: program to convert Celsius to Fahrenheit
  21. Python Program to Swap Two Numbers
  22. Python Program to Get Standard Deviation
  23. Python Program to Find the Variance
  24. Python Program to Convert Height in cm to Feet and Inches
  25. Python Program to Convert Meters into Yards, Yards into Meters
  26. Python Program to Convert Kilometers to Meters, Miles
  27. Python Program to Find Perfect Number
  28. Python: Program to Find Strong Number
  29. Python Program Create Basic Calculator
  30. Python Program For math.floor() Method
  31. Python Program to Find Sum of Series 1/1! 2/2! 3/3! …1/n!
  32. Python: Program to Convert Decimal to Binary, Octal and Hexadecimal
  33. Python Program to Find Roots of Quadratic Equation
  34. Python Program to Print Alphabets from A to Z in Uppercase and Lowercase
  35. Python Program to Check Given Input is Alphabet, Number or Special Character
  36. Python Program to Calculate the Area of a Rectangle
  37. Python Program to Calculate Area of Triangle
  38. Python Program to Find Area and Circumference of Circle using Radius
  39. Python Program that Accepts Marks in 5 Subjects and Outputs Average Marks
  40. Python Program to Print Binary Value of Numbers From 1 to N
RELATED ARTICLES

Most Popular

Recent Comments