matplotlib 画饼图
作者:互联网
有个瑕疵,某一块儿比例过小时,文字会重叠。
1 def pizza(data,labs,title): 2 import matplotlib 3 import matplotlib.pyplot as plt 4 cols=[col for col in matplotlib.colors.TABLEAU_COLORS][:len(data)] 5 plt.pie(data,labels=labs,colors=cols,startangle=90, 6 textprops={'fontsize':10,'color':'k'},shadow= False,autopct='%1.2f%%') 7 plt.legend(loc="upper right",fontsize=10,bbox_to_anchor=(1.1,1.05),borderaxespad=0.1) 8 plt.title(title) 9 plt.show() 10 11 pizza([305,9695,1000],["F","HQ","samll"],"pizaa")
标签:10,plt,title,cols,matplotlib,画饼,data 来源: https://www.cnblogs.com/mmtinfo/p/11917986.html