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