From: Brendan on
Hi. I'm trying to create a stacked bar graph but to change the colors of the bars from the default to something that's more legible for my needs. My problem is that I expect to have a bunch of zeros (so some bars won't show up) which means I need a more distinguishing color map.

Here is what I have countErrorType is what I want to create the stacked bar graph of, ColorOrder2 is what I want my bars to have their colors be

countErrorType=[0 0
0 0
0.2100 0.2250
0.2800 0.3100
0.0100 0.0100
0 0
0.1800 0.1700
0 0
0.1900 0.1900
0.0300 0.0100
0 0
0.0750 0.0700
0 0
0.0250 0.0150
0 0];

ColorOrder2=[1 1 1;
0.5 1 0.5;
0 1 0;
0 0.5 0;
1 0.5 0.5;
1 0.2 0.2;
1 0 0;
0.8 0 0;
0.5 0 0;
0.5 0.5 1;
0.2 0.2 1;
0 0 1;
0 0 0.8;
0 0 0.5;
0 0 0];

h=bar(numSampArray,countErrorType','Stacked');


I tried following the shading example in the help file, but couldn't modify it to my needs.

Thank you for your help

Brendan
From: Brendan on
For anyone else wondering, it's apparently really easy
just use

colormap(ColorOrder2)