Skip to content

Instantly share code, notes, and snippets.

@yatakeke
Last active August 1, 2020 07:32
Show Gist options
  • Save yatakeke/0686561473a4720fb982410287268bb5 to your computer and use it in GitHub Desktop.
Save yatakeke/0686561473a4720fb982410287268bb5 to your computer and use it in GitHub Desktop.
matplotlib pie chart
import matplotlib.pyplot as plt
plt.pie(fraction, startangle, wedgeprops, autopct, explode, **)
# example: plt.pie(frac, startangle=90, wedgeprops={'linewidth': 3, 'edgecolor':"white"}, autopct="%1.1f%%", explode=[0.2, 0, 0, 0, 0]
# fraction: total of fraction should be 1
# startangle: startangle
# wedgeprops: edge props
# autopct: show percentage
# explode: array for explode
plt.legend(labels, bbox_to_anchor, loc)
# labels: labels of fraction
# bbox_to_anchor: relative position to whole of figure
## range => (0, 0) ~ (1, 1)
# loc: which part of box is set up anchor
## ボックスのどの部分をアンカーに合わせるか
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment