How to change the color of a stacked bar?
6 views (last 30 days)
DGM on 27 Mar 2021
Edited: DGM on 27 Mar 2021
There are probably various ways to solve this. If the colors are adequate and you merely want to change their ordering, consider the example:
% simple stacked bar chart
A = [3 2 5; 2 1 6; 5 8 2];
newordering=[3 2 1];
This gives us the result:
In this case, I reversed the color order, but you can specify any order with the variable newordering.
This works in R2019b, but not R2015b. Unless specified otherwise, I'm going to assume you are using a relatively new version.