フィルターのクリア

Make Y-axis show percentage of values, highest value to be set as 100%.

4 ビュー (過去 30 日間)
Rudolf
Rudolf 2021 年 4 月 15 日
コメント済み: Rudolf 2021 年 4 月 20 日
How can I get my values in y to be represented in percent according to the highest value in y on a bar plot?
Incomplete code:
y = [10.6, 6.4, 5.2, 5.2, 6.3, 14.3, 19.0, 22.3, 22.5, 25.9...
26.5, 25.1, 24.3, 24.6, 23.9, 23.6, 23.2, 24.6, 22.7, 23.4...
26.2, 26.6, 25.1, 22.9];
m = max(y);
bar(y)
set(gca, 'XTick', [1:1:24], 'XTickLabel', rem([0:1:23],24))

採用された回答

David Fletcher
David Fletcher 2021 年 4 月 15 日
y = [10.6, 6.4, 5.2, 5.2, 6.3, 14.3, 19.0, 22.3, 22.5, 25.9...
26.5, 25.1, 24.3, 24.6, 23.9, 23.6, 23.2, 24.6, 22.7, 23.4...
26.2, 26.6, 25.1, 22.9];
m = max(y);
yPc=y/m*100
bar(yPc)
set(gca, 'XTick', [1:1:24], 'XTickLabel', rem([0:1:23],24))
  1 件のコメント
Rudolf
Rudolf 2021 年 4 月 20 日
Thanks for the math. :) Got the percentage sign added by using code from the last answer in this post: https://www.mathworks.com/matlabcentral/answers/390402-how-to-change-y-axis-label-with-percentage

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by