how to write the percentage into pie chart?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lilya
el 22 de Mayo de 2016
Comentada: Gwen
el 31 de Ag. de 2020
hi all, the attached pie chart shows the percentage of variance. I want to write the percentage inside sector and the txt definition outside. Please help me.
0 comentarios
Respuesta aceptada
Stephen23
el 22 de Mayo de 2016
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 comentarios
Jaladhar Mahato
el 12 de En. de 2018
I got the answer. I have to just put 'FontSize' at the end text comment.
text(P(:,1),P(:,2),L(:),'FontSize',18)
Gwen
el 31 de Ag. de 2020
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!
Más respuestas (0)
Ver también
Categorías
Más información sobre Pie Charts en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!