how to write the percentage into pie chart?
11 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Stephen23
2016 年 5 月 22 日
L = {'A','B','C','D','E'};
X = [ 1, 3,0.5,2.5, 2];
H = pie(X);
%
T = H(strcmpi(get(H,'Type'),'text'));
P = cell2mat(get(T,'Position'));
set(T,{'Position'},num2cell(P*0.6,2))
text(P(:,1),P(:,2),L(:))
Creates this:
10 件のコメント
Jaladhar Mahato
2018 年 1 月 12 日
I got the answer. I have to just put 'FontSize' at the end text comment.
text(P(:,1),P(:,2),L(:),'FontSize',18)
Gwen
2020 年 8 月 31 日
Hi, this was a really helpful answer. Thank you @Stephen Cobeldick. I am wondering if you can help me relocate some of the external text labels. You'll notice "NH4+" and "Na+" are written too close to the pie chart...
Thanks in advance!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Pie Charts についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!