![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174341/image.png)
how to write the percentage into pie chart?
조회 수: 5 (최근 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174341/image.png)
댓글 수: 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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/353876/image.png)
추가 답변 (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!