推荐两个非常好的博客内容:
Python实现可视化(二)--label字体大小调整、图例设置https://blog.csdn.net/weixin_39602776/article/details/111314454Python绘制饼图调节字体大小、防止标签重叠解决方法 https://www.cnblogs.com/mengxiaoleng/p/12804117.html然后是我自己的饼图代码,里面用到了字体大小调整这部分的功能:
import matplotlib import matplotlib.pyplot as plt matplotlib.rcParams['backend'] = 'SVG' A=[15.8,0.6,0.0296] labels='','','' sizes=A[0],A[1],A[2] explode=0.05,0.1,0.15 colors='skyblue','gold','green' fig,ax = plt.subplots(figsize=(13,7)) #创建大小为(14,7)的画布,同时创建一个axes,把axes赋值给ax patches,l_text,p_text=ax.pie(sizes,explode=explode,labels=labels, colors=colors,autopct='%1.1f%%',shadow=False,startangle=50) # ax.set_title('FEMM Loss percentage',fontsize=18) ax.legend(labels = ['conductor 1','conductor 2','others'],loc=2,fontsize=14) ax.set_aspect('equal') for t in p_text: t.set_size(15)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)