Created
February 15, 2021 22:44
-
-
Save canimus/c9584c71e1cab37ddfca4feab3026d29 to your computer and use it in GitHub Desktop.
Pie Chart Matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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