How to create bar graph with portions (multi-dimensional)?
5 views (last 30 days)
Show older comments
I want to create a bar graph with following qualities:
- Bar itself is split into 3 color categories, indicating portions between variables (individual y-axis from 0 - 100 %)
- Overall bar height indicates another variable height (individual y-axis)
So in total the data has 3 dimensions and it combines pie chart qualities to bar graph. This would be very nice way to visualize the data as I'm conducting near infrared spectroscopy analysis and want to compare thickness values in addition to absorption.
I think I need combine multiple y-axis with stacked groupping style (as in the picture below).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/690533/image.png)
How to create this kind of bar graph?
0 Comments
Answers (2)
the cyclist
on 20 Jul 2021
This example from the documentation shows exactly how to do it.
y = [2 2 3;
2 5 6;
2 8 9;
2 11 12];
bar(y,'stacked')
You may need to adjust the code a bit, because it seems like you want to use proportions rather than values.
See Also
Categories
Find more on Bar Plots 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!