Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Last active January 16, 2020 23:38
Show Gist options
  • Save Ze1598/c243dd6a2e9849a6c73d29c202b677cf to your computer and use it in GitHub Desktop.
Save Ze1598/c243dd6a2e9849a6c73d29c202b677cf to your computer and use it in GitHub Desktop.
Matplotlib intro: pie charts
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