Make Y-axis show percentage of values, highest value to be set as 100%.
3 views (last 30 days)
Show older comments
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))
0 Comments
Accepted Answer
David Fletcher
on 15 Apr 2021
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))
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!