Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/donut plot.py Secret

Created Dec 16, 2020
Embed
What would you like to do?
import seaborn as sns
import matplotlib.pyplot as plt
group_size = [sum(df.positive), sum(df.active), sum(df.cured)]
group_labels = ["Positive\n"+str(sum(df.positive)),
"Active\n"+str(sum(df.active)),
"Cured\n"+str(sum(df.cured))]
custom_colors = ["skyblue", "yellowgreen", 'tomato']
plt.figure(figsize=(5, 5))
plt.pie(group_size, labels=group_labels, colors=custom_colors)
central_circle = plt.Circle((0, 0), 0.5, color='white')
fig = plt.gcf()
fig.gca().add_artist(central_circle)
plt.rc('font', size=12)
plt.title("Total Positive, Active, and Cured Cases", fontsize=20)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment