Last active
January 16, 2020 23:38
-
-
Save Ze1598/c243dd6a2e9849a6c73d29c202b677cf to your computer and use it in GitHub Desktop.
Matplotlib intro: pie charts
This file contains hidden or 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
from matplotlib import pyplot as plt | |
slices = [1, 9, 3, 3, 4] | |
labels = ["Management", "Sales", "Quality Assurance", "Accounting", "Human Resources"] | |
colors = ["#ff9999", "#66b3ff", "#99ff99", "#ffcc99", "#cccccc"] | |
plt.pie(slices, labels=labels, colors=colors, autopct="%1.2f%%") | |
plt.title("Size of departments at Company A") | |
plt.tight_layout() | |
plt.savefig("pie_chart_demo.png") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment