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

Saturday, April 23, 2022

[FIXED] How to change direction of pie diagram in python matplotlib?

 April 23, 2022     matplotlib, pie-chart, python     No comments   

Issue

Trying to change pie diagram direction from right-left, to left-right direction. Now it looks like this:

from matplotlib import pyplot as plt
eye_color = {'blue':5,'green':10,'brown':20, 'black':15 }

sum([v for v in eye_color.values()])
P = [f/sum([v for v in eye_color.values()]) for f in eye_color.values()]
plt.pie(P, labels = [k for k in eye_color.keys()], startangle = 90, autopct = '%1.1f%%',
       shadow = True) 
plt.axis('equal')
plt.show()

How to show it like this, when first part angle degree going to a positive direction, right?:

enter image description here

Any help is greatly appreciated. Thanks in advance :)


Solution

As per the documentation, use

counterclock=False



Answered By - Diziet Asahi
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