From: Pragya on
Hi,

I want to plot a grouped bar graph. When I do this, it takes red and blue by default as colors to plot [11 10
46 32
33 44];
in the form of a bar graph. I want the 46 and 32 bars to be black in color. How can I do that?

Thanks...
From: us on
"Pragya " <pragoel12(a)yahoo.com> wrote in message <i2kav6$93t$1(a)fred.mathworks.com>...
> Hi,
>
> I want to plot a grouped bar graph. When I do this, it takes red and blue by default as colors to plot [11 10
> 46 32
> 33 44];
> in the form of a bar graph. I want the 46 and 32 bars to be black in color. How can I do that?
>
> Thanks...

one of the (not so many) solutions

m=[
11 10
46 32
33 44
];
bh=bar(m);
colormap(jet(10));
colorbar;
bc=get(bh,'children');
set([bc{:}],...
'cdatamapping','direct',... % <- ie, CDATA indices -> COLORMAP
{'cdata'},{[1,4,2];[9,8,10]}); % <- series #1, series #2

us