From: Ken Fleisher on
Hello. I need to make a clustered bar chart with categories and sub-categories. I've looked on the file exchange to see if there was something there, but found nothing that would suit my needs. As an example, this clustered stacked bar chart <http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html> is similar to what I want to do, except I don't want to stack the bars.

An example:

I have R, G, B values for each of camera 1, 2, 3, 4, etc. The RGB values need to be clustered for each camera (the camera is the sub-category). This part is easy. Next, I have this entire set of data for each f-stop f/5.6, f/8, f/11, etc. (the aperature is the primary category):

5.6 cam1 R
5.6 cam1 G
5.6 cam1 B

5.6 cam2 R
5.6 cam2 G
5.6 cam2 B

5.6 cam3 R
5.6 cam3 G
5.6 cam3 B

-

8 cam1 R
8 cam1 G
8 cam1 B

8 cam2 R
8 cam2 G
8 cam2 B

8 cam3 R
8 cam3 G
8 cam3 B


I can figure out how to do this, but my time is short, so I thought I'd ask if anyone has a function like this that they may be willing to share. If not, does anyone have any suggestions about the most efficient way to go about this?

Thanks in advance for any help you can provide.

Ken Fleisher
From: us on
"Ken Fleisher" <k-fleisher.donotspamme(a)nga.gov> wrote in message <hshh7q$kfs$1(a)fred.mathworks.com>...
> Hello. I need to make a clustered bar chart with categories and sub-categories. I've looked on the file exchange to see if there was something there, but found nothing that would suit my needs. As an example, this clustered stacked bar chart <http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html> is similar to what I want to do, except I don't want to stack the bars.
>
> An example:
>
> I have R, G, B values for each of camera 1, 2, 3, 4, etc. The RGB values need to be clustered for each camera (the camera is the sub-category). This part is easy. Next, I have this entire set of data for each f-stop f/5.6, f/8, f/11, etc. (the aperature is the primary category):
>
> 5.6 cam1 R
> 5.6 cam1 G
> 5.6 cam1 B
>
> 5.6 cam2 R
> 5.6 cam2 G
> 5.6 cam2 B
>
> 5.6 cam3 R
> 5.6 cam3 G
> 5.6 cam3 B
>
> -
>
> 8 cam1 R
> 8 cam1 G
> 8 cam1 B
>
> 8 cam2 R
> 8 cam2 G
> 8 cam2 B
>
> 8 cam3 R
> 8 cam3 G
> 8 cam3 B
>
>
> I can figure out how to do this, but my time is short, so I thought I'd ask if anyone has a function like this that they may be willing to share. If not, does anyone have any suggestions about the most efficient way to go about this?
>
> Thanks in advance for any help you can provide.
>
> Ken Fleisher

CSSM does not get sufficient information about several things, eg, how do you store your categories...
hence, only a hint:

help bar; % <- peruse the STACK option...

us
From: Ken Fleisher on
"us " <us(a)neurol.unizh.ch> wrote in message <hshibd$4u6$1(a)fred.mathworks.com>...

> CSSM does not get sufficient information about several things, eg, how do you store your categories...
> hence, only a hint:
>
> help bar; % <- peruse the STACK option...
>
> us

Thank you for the reply. I can store the data and categories however I want, so I'm flexible. As I noted in the original post, I do not want to use the stack option because it does not fully make sense for the data I'm presenting.

Another way to explain what I want is to have several bar charts on a single chart, where each bar chart is a separate super-category. I could just make separate charts for each, but I thought the presentation might be easier to interpret if the data were all on a single chart. The part I'm stuck on is how to combine all the separate bar charts into a single one and show each as a super-category. I'm looking for some kind of visual cue that will make it clear where one super-category ends and the next begins. Does that make sense?
From: Ken Fleisher on
"Ken Fleisher" <k-fleisher.donotspamme(a)nga.gov> wrote in message

>The part I'm stuck on is how to combine all the separate bar charts into a single one and show each as a super-category. I'm looking for some kind of visual cue that will make it clear where one super-category ends and the next begins.


I should clarify that statement. I'm not actually stuck, I can figure out how to do this. I'm just short on time and was hoping someone could either 1) share a similar solution that they have already come up with or 2) suggest a quick and efficient way to accomplish this.

Thanks.

Ken
From: Alan B on
"Ken Fleisher" <k-fleisher.donotspamme(a)nga.gov> wrote in message <hshlb1$m1k$1(a)fred.mathworks.com>...
> "Ken Fleisher" <k-fleisher.donotspamme(a)nga.gov> wrote in message
>
> >The part I'm stuck on is how to combine all the separate bar charts into a single one and show each as a super-category. I'm looking for some kind of visual cue that will make it clear where one super-category ends and the next begins.
>
>
> I should clarify that statement. I'm not actually stuck, I can figure out how to do this. I'm just short on time and was hoping someone could either 1) share a similar solution that they have already come up with or 2) suggest a quick and efficient way to accomplish this.
>
> Thanks.
>
> Ken

Why not just call bar within a for loop? Unless I misunderstand...

data = [1 2 3; 2 3 4; 3 4 5];
xoffs = linspace(-.25,.25,size(data,2));
colors='rgb';
for cluster=1:size(data,1)
bar(cluster+xoffs, data(cluster,:),colors(cluster))
end