×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python | Clockwise and Anticlockwise Pie Chart

In this tutorial, we are going to explore the clockwise and anticlockwise mode of plotting Pie charts.
Submitted by Anuj Singh, on August 05, 2020

Following example is an illustration for the same.

Illustration:

Python | Clockwise Pie Chart

Python | Anticlockwise Pie Chart

Python code for clockwise and anticlockwise pie chart

import matplotlib.pyplot as plt

# Pie chart, where the slices will be 
# ordered and plotted counter-clockwise:
labels = 'A', 'B', 'C', 'D', 'E', 'F'
sizes = [15, 20, 10, 17, 1, 37]
alp = (0.9, 0.9, 0.9, 0, 0.9, 0.9)
plt.figure()
plt.title('Clock Wise Plotting in Pie Chart')
plt.pie(sizes, labels=labels, counterclock=False, autopct='%1.1f%%', shadow=True)
plt.axis('equal')  
plt.show()


plt.figure()
plt.title('Anticlock Wise Plotting in Pie Chart')
plt.pie(sizes, labels=labels, counterclock=True, autopct='%1.1f%%', shadow=True)
plt.axis('equal')  
plt.show()

Output:

Output is as figure
Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.