Wanted to have a pie chart with class label as well as the percentage.
This does the job.
class = [Count1 Count2 Count3 Count4];
b = (round(class/sum(class)*100))
% explode = [0,0,1]; % well you can explode it
h=pie(class, {['Class 1 (',num2str(b(1)),'%)'],['Class 2 (',num2str(b(2)),'%)'], ['Class 3 (',num2str(b(3)),'%)'],['Class 4 (',num2str(b(4)),'%)']});
% pie(class,{'Class 1 ','Class 2','Class 3 ', 'Class 4 '})
% well try pie3 too
No comments:
Post a Comment