首页 > 解决方案 > How to make pie chart with optimized code?

问题描述

What is the shortest and most optimal code for make pie chart? I want to make a pie chart using python. I tried to use the best library but most of them were long. Anyone have a shortcut?

标签: pythoncharts

解决方案


import matplotlib.pyplot as plt
percent = [ x, y, z]
colour = [blue, green, red]
label = [name1, name2, name3]
plt.pie(percent , labels=label ,colors=colour)
plt.show()


#The sum of the values ​​of x,y,z must be 100 for 100%

推荐阅读