f



Changing colors of stacked bar graph

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
0
Brendan
8/12/2010 12:12:11 PM
comp.soft-sys.matlab 211266 articles. 22 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
2005 Views

Similar Articles

[PageSpeed] 24

For anyone else wondering, it's apparently really easy
just use

colormap(ColorOrder2)
0
Brendan
8/12/2010 9:03:06 PM
Reply: