Stacked bar chart similar to Excel
Show older comments
Hi
I have the attached Excel sheet contains data to plot a stacked bar chart.
I want to plot it like the below picture from Excel:

Can I do that in MATLAB please?
Thanks
Accepted Answer
More Answers (1)
Devanuj Deka
on 15 Jul 2021
Edited: Devanuj Deka
on 15 Jul 2021
0 votes
Yes, you can. MATLAB's bar function has an optional style parameter that you can use to display stacked bar chart. Here is the documentation: bar(___,style)
If you specify the style parameter as 'stacked', you can create a stacked bar chart. For more information: style
2 Comments
AHMED FAKHRI
on 15 Jul 2021
Devanuj Deka
on 16 Jul 2021
Edited: Devanuj Deka
on 16 Jul 2021
@AHMED FAKHRI, I have posted another answer with a code. Please check that out and let me know if you can work with this.
Categories
Find more on Discrete Data 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!



