PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] How plot Pie_chart in python while having 3 columns of data

 April 22, 2022     data-visualization, matplotlib, pie-chart, plot, python     No comments   

Issue

Charging Number Share
0-20%. 9. 15.50%
21-40%. 18. 31%.
41-60%. 4. 6.90%
61-80%. 9. 15.50%
81-100% 8. 13.80%
>100% 10. 17.30%

Solution

You can use pie() function from pyplot to draw pie charts in python. First you need to install matplotlib:

pip install matplotlib

Then you can create pie charts by providing the sizes and labels:

import matplotlib.pyplot as plt

labels = 'Charging', 'Number', 'Share'
sizes = [20, 9, 15.5]

fig1, ax1 = plt.subplots()
ax1.pie(sizes, labels=labels, startangle=90)
ax1.axis('equal')

plt.show()

Pie chart documentation: pyplot-pie



Answered By - Dan Constantinescu
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing