Skip to content

Instantly share code, notes, and snippets.

@canimus
Created February 15, 2021 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canimus/c9584c71e1cab37ddfca4feab3026d29 to your computer and use it in GitHub Desktop.
Save canimus/c9584c71e1cab37ddfca4feab3026d29 to your computer and use it in GitHub Desktop.
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