Funciton grafik bagan donat
def pie_chart_single(labels, sizes, colors):
textprops = {"fontsize":16}
wedgeprops = {'linewidth': 4, "edgecolor": "w"} #creates white lines around each wedge
plt.pie(sizes, colors = colors, labels = labels, autopct = '%1.1f%%', #display numbers to 1 decimal point
startangle=90, pctdistance = 0.5, textprops = textprops, wedgeprops = wedgeprops)
centre_circle = plt.Circle((0,0),0.6,fc='white') #draw white circle at center to create donut chart
plt.gcf().gca().add_artist(centre_circle) #gcf: get current figure, gca: get current axis
plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle
plt.tight_layout()
plt.show()
Chunxiao Wang