How to control color of each bar (all stacks same color) in stacked bar chart?
Show older comments
I have a bar chart with multiple stacks. I would like to represent all stacks of same bar with same color, while changing colors across bars. Is this possible? In the figure below, I would like bars 4, 3, 2, 1 to be of different colors but the stacks within one bar to be same. (My goal is to represent timeline of events using bar command)
data_with_init_time = [
1, 10, 5, 3 ;
3, 10, 3, 9 ;
7, 10, 4, 8 ;
12,10, 2, 2 ];
h = barh(data_with_init_time, 'stack');
Accepted Answer
More Answers (0)
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!
