How to show both value and percentage in a piechart

조회 수: 6 (최근 30일)
Yajie Liang
Yajie Liang 2020년 4월 15일
댓글: Ameer Hamza 2020년 4월 17일
Hi, I googled a while but did not find a good resolution. Is there a simple way to do that? thanks

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 15일
Try this
X = [1/3 2/3];
value = compose(['Val=%.3f'], X);
percents = compose([newline 'P=%.3f%%'], X/sum(X)*100);
pie(X, strcat(value, percents))
  댓글 수: 2
Yajie Liang
Yajie Liang 2020년 4월 16일
Great! Thanks a lot!
Ameer Hamza
Ameer Hamza 2020년 4월 17일
I am glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by