From: cabrego on 27 May 2010 14:41 Hello all, I have very complicated data that I am attempting to plot . I would like to generate a stacked bar chart at a specific (x,y) coordinate (if that makes sense). The x and y coordinates are actually categories or strings and not numerical values. So you can think of it as a grid and each grid locations requires a specific stacked bar chart. I would also like the width of each bar to be adjustable based on a variable I define. I am not sure what the name of these charts are, or if they even have a name. Is this possible?
From: Walter Roberson on 27 May 2010 14:55 cabrego wrote: > I would like > to generate a stacked bar chart at a specific (x,y) coordinate (if that > makes sense). bar(linspace(Startingx,Endingx,length(BarData)), y+(BarData-min(BarData)) )
From: cabrego on 27 May 2010 15:33 Walter Roberson <roberson(a)hushmail.com> wrote in message <htmf8p$j91$1(a)canopus.cc.umanitoba.ca>... > cabrego wrote: > > I would like > > to generate a stacked bar chart at a specific (x,y) coordinate (if that > > makes sense). > > bar(linspace(Startingx,Endingx,length(BarData)), y+(BarData-min(BarData)) ) Thanks for the tip, I ran the code to test it and I don't think it is adaptable for my problem. I am not sure if I explained my problem clearly so I will try to reiterate my problem. I would like to specify the placement of 20 bar charts on a single plot (i.e., each bar is located at a specific (x,y) LOCATION on the plot). So the plot will have 5 'xlocation' categories and 4 'ylocation' categories (The categories will actually be strings) for a total of 20 unique stacked bar graphs in a single figure. Hope this makes sense...
From: Walter Roberson on 27 May 2010 16:59 cabrego wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <htmf8p$j91$1(a)canopus.cc.umanitoba.ca>... >> cabrego wrote: >> > I would like > to generate a stacked bar chart at a specific (x,y) >> coordinate (if that > makes sense). >> bar(linspace(Startingx,Endingx,length(BarData)), >> y+(BarData-min(BarData)) ) > Thanks for the tip, I ran the code to test it and I don't think it is > adaptable for my problem. I am not sure if I explained my problem > clearly so I will try to reiterate my problem. > > I would like to specify the placement of 20 bar charts on a single plot > (i.e., each bar is located at a specific (x,y) LOCATION on the plot). > So the plot will have 5 'xlocation' categories and 4 'ylocation' > categories (The categories will actually be strings) for a total of 20 > unique stacked bar graphs in a single figure. > Hope this makes sense... Right, the code was intended to solve that, but I see that it would have drawn right to 0 axis. Okay, I think this should work: bar(linspace(Startingx,Endingx,length(Bardata)), y+BarData, 'BaseValue',y) Here, Startingx and Endingx are the coordinates for the lowest and highest x that you want the individual chart drawn at. I did not assume here that your coordinate system is pixels and did not assume that you want only one pixel per bar. Endingx minus Startingx would be the width you want the chart drawn in axis units, so if you prefer you could rewrite this as linspace(Startingx, Startingx + ChartWidth, length(Bardata)) If you prefer another approach, you could create a hgtransform and use it as the parent for the bar chart and then scale and rotate and translate the chart into whatever position you wanted.
From: cabrego on 28 May 2010 13:00 > Okay, I think this should work: > > bar(linspace(Startingx,Endingx,length(Bardata)), y+BarData, 'BaseValue',y) > OK, I guess one of the complications I did not anticipate is that each bar does not use an assigned value from the x,y axis. Every bar will have a value that add to 100% and are indepdent from the X,Y axis, additionally the X,Y axis are not numberical values but are categories. Here is a rough sketch. | 'Cat D' [] [] | 'Cat C' [] [] ___|___________________________ 'Cat A' 'Cat B' The centroid of each bar is predefined in terms of their category location and their length/width(I think?) and will alll be "floating" so to speak, The real data essentially shades the bars by x+y+z+.. percent. The real data may also determine the width of the bars. Am I beyond matlab's plotting capability?
|
Next
|
Last
Pages: 1 2 Prev: superimposing plots obtained using imfreehand Next: Synchronized data acquisition in MATLAB? |