matlab 如何在饼图上既有比例又有标注

如题所述

x=numE(1:end)./1e4;% cost

for i=3:1:(length(numE)+2)

    label1{i-2,1} = txtE{i,1};% label

end

ax1 = subplot(1,2,1);

explode1=[zeros(1,length(x)-1),1];

p=pie(ax1,x,explode1);

title(ax1,'Main-Cost Distribution');

%%以下为比例+标注

pText = findobj(p,'Type','text');

percentValues = get(pText,'String'); 

combinedtxt = strcat(label1,percentValues); 

for i=1:1:length(x)

    pText(i).String = combinedtxt(i);

end

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网