Skip to content

Instantly share code, notes, and snippets.

@Abuton
Created September 25, 2021 10:33
Show Gist options
  • Save Abuton/52b45dbee74d5f3213853202a6cd8bd2 to your computer and use it in GitHub Desktop.
Save Abuton/52b45dbee74d5f3213853202a6cd8bd2 to your computer and use it in GitHub Desktop.
def pie_chart(user):
fig, ax = plt.subplots(figsize=(15, 8))
explodex = []
for i in np.arange(len(user)):
explodex.append(0.005)
ax = user.plot(kind='pie', colors=['red', 'green', 'cyan', 'lime', 'gold'],
fontsize=12, autopct='%1.1f%%', startangle=180,
pctdistance=0.85, explode=explodex)
inner_circle = plt.Circle((0,0), 0.50, fc='white')
fig = plt.gcf()
fig.gca().add_artist(inner_circle)
ax.axis('equal')
ax.set_title('Distribution of User with charts', fontsize=20)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment