Answers for "Create donut chart using matplotlib"

0

Create donut chart using matplotlib

# library
import matplotlib.pyplot as plt

# create data
size_of_groups=[12,11,3,30]

# Create a pieplot
plt.pie(size_of_groups)

# add a circle at the center to transform it in a donut chart
my_circle=plt.Circle( (0,0), 0.7, color='white')
p=plt.gcf()
p.gca().add_artist(my_circle)

plt.show()
Posted by: Guest on June-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language