Skip to content

Instantly share code, notes, and snippets.

@canimus

canimus/pie.py

Created Feb 15, 2021
Embed
What would you like to do?
Pie Chart Matplotlib
import matplotlib.pyplot as plt
# create data
names='Failed: 20', 'Passed: 80',
size=[11.8, 98.2]
# Create a circle for the center of the plot
my_circle=plt.Circle( (0,0), 0.7, color='white')
plt.pie(size, labels=names, colors=['#f56262', '#23d993'])
plt.title('CET2 / 2021-02-16', weight='bold')
plt.text(0.01, -.01, '98.10%', ha='center', weight='normal', fontsize=22)
plt.text(0.01, -.20, 'pass rate', ha='center', weight='normal', fontsize=10)
plt.text(0.01, 1.15, 'Automated Regression Test Results', ha='center', weight='normal', fontsize=10)
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.savefig('pie.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment