我是新手,今天用python 画了饼状图,出现的标题重叠问题
代码数据
labels = [u'headBlock\n', u'LeftBlock\n', u'RightBlock\n', u'OtherBlock\n']
fracs = [count_dict[1] / cnumber * 100, count_dict[2] / cnumber * 100, count_dict[3] / cnumber * 100,
(cnumber - count_dict[1] - count_dict[2] - count_dict[3]) / cnumber * 100]
explode = [x * 0.01 for x in range(4)] # 与labels一一对应,数值越大离中心区越远
plt.axes(aspect=1) # set this , Figure is round, otherwise it is an ellipse
# autopct ,show percet
plt.pie(x=fracs, labels=labels, explode=explode, autopct='%3.1f %%',
shadow=True, labeldistance=1.1, startangle=90, pctdistance=0.6
)
#plt.legend(loc=7, bbox_to_anchor=(1.2, 0.80), ncol=3, fancybox=True, shadow=True, fontsize=8)
plt.title(titlename)
输出图片格式
跪求大神们的解决办法