Pie chart percentages are not correct

5 ビュー (過去 30 日間)
kcl128
kcl128 2016 年 7 月 1 日
コメント済み: kcl128 2016 年 7 月 2 日
I am plotting two variables (c and e) into a pie chart. The calculated percentage is 73% but the chart shows 42%. The percentages appear correct for lower values. I attach the code, the variables, the percentage calculation and the pie chart. I have cleared the variables before running the code.
Any advice most welcome.
Thank you.
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 1 日
Post your code as a text.

サインインしてコメントする。

採用された回答

Chad Greene
Chad Greene 2016 年 7 月 1 日
If
z = [20318 28008]
then the first value, 20318 represents 42% of the total value of z.
100*20318/sum(z)
= 42%
  1 件のコメント
kcl128
kcl128 2016 年 7 月 2 日
Thank you for your response Chad. The total sample is 28008 and of that total sample 20318 are outside the prescribed criterion, so what I was looking for in the pie chart is what percentage 20318 is of 28008 i.e. 73%. It seems that I have misunderstood the pie function. I will need to re-jig the two values in z to give me the correct answer. Again, thanks for the comment.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePie Charts についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by