import numpy as np import matplotlib.pylab as mp values = [26, 17, 21, 29, 11] spaces = [0.05, 0.01, 0.01, 0.01, 0.01] labels = ['Python', 'JavaScript', 'C++', 'Java', 'PHP'] colors = ['dodgerblue', 'orangered', 'limegreen', 'violet', 'gold'] mp.figure('Pie', facecolor='lightgray') mp.axis('equal') mp.pie( values, spaces, labels, colors, "%.2f%%", shadow=True, startangle=0, radius=1 ) mp.legend(loc=1) mp.show()
来源:https://www.cnblogs.com/yuxiangyang/p/11325762.html