How to set the direction of pie chart in Python Matplotlib?
Clockwise vs anti-clockwise pie charts:
To specify fractions direction of the pie chart, you must set the counterclock parameter to True or False (value is True by default).
import matplotlib.pyplot as plt labels = ['India', 'Canada', 'Japan', 'Australia', 'Russia'] sizes = [31, 19, 15, 14, 21] # Add upto 100% # Plot the pie chart plt.pie(sizes, labels=labels, counterclock=False, startangle=90) # Equal aspect ratio ensures that pie is drawn as a circle. plt.axis('equal') # Display the graph onto the screen plt.show()
plt.pie(sizes, labels=labels, counterclock=True, startangle=90)
2018-11-04T12:34:51+05:30
2018-11-04T12:34:51+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution