Author |
Topic |
|
koshikaw@n
Japan
3 Posts |
Posted - 03/09/2003 : 04:41:53 AM
|
Can I create a stock column graph with two grouped data sets?
As an example, a simple data set is shown.
[X]*[A]*[B]*[C]*[D] *1***3***2***2***2 *2***2***2***1***2 *3***2***1***3***2
Here, rows of "[A] & [B]" and "[C] & [D]" are grouped Y data, respectively. I'd like to make two stack columns against each X value as below. How can I do such a plot?
**|*B*************D **|*B*D***B*******D Y*|*A*D***B*D***B*C **|*A*C***A*D***A*C **|*A*C***A*C***A*C **------------------ *****1*****2*****3 ***********X
Thanks in advance
|
|
cjfraz
USA
22 Posts |
Posted - 03/11/2003 : 09:16:43 AM
|
There may be multiple solutions, but for this simple case my approach would be to add two new columns to the worksheet and then type the following commands into the script window:
col(e)=col(a)+col(b); col(f)=col(c)+col(d);
Then make a column graph with E and F as Y datasets against your X dataset.
J...
ps- note that in a typical worksheet col(a) would be your X dataset and your next four columns would be B-E, so the above script would have to be adjusted to use the actual column names, e.g. col(f)=col(b)+col(c); col(g)=col(d)+col(e);
|
|
|
Laurie
USA
404 Posts |
Posted - 03/11/2003 : 11:39:58 AM
|
The solution given above works but you won't get the individual group members for the stacking; you'll just see one solid color for each column.
You could create 2 stacked column graphs; one with A and B and the other with C and D. Then merge the two by selecting Edit:Merge all Graph Windows. Now reposition layer 2, turn off the axes and set the Spacing in Plot Details. This method takes a bit of manipulating, but you can set the graph up. You'll probably also want to turn off the X axis tick labels and then create your own by just adding text labels.
OriginLab Technical Support |
|
|
cjfraz
USA
22 Posts |
Posted - 03/11/2003 : 12:09:46 PM
|
hmmm. I see your point Laurie, which I had not considered. Another possibility for making a stack column as you describe (instead of just a column with the sums) would be to simply rearrange the data in the original worksheet from how koshikaw presented it... i.e.
[x] , [y1] , [y2] 1 , 3 , 2 2.2 , 2 , 2 4 , 2 , 2 5.2 , 1 , 2 7 , 2 , 1 8.2 , 3 , 2
all of the x values of x.2 have the data that was previously in col(c) and col(d). With the data arranged this way you can just make a vanallia single layer stacked column graph and get the same result as with the two layer solution. If necessary it probably wouldn't be difficult to write a script to rearrange the data this way automatically.
J...
Edited by - cjfraz on 03/11/2003 12:47:44 PM |
|
|
koshikaw@n
Japan
3 Posts |
Posted - 03/12/2003 : 02:40:30 AM
|
Thanks, Charles and Laurie. I tried the suggested two methods and they works well!
From my this experience, I would like to add some info to Charles' way. To apply Charles' mehtod, I think it's better to make data rearrangement as follows.
[X], [Y1], [Y2], [Y3], [Y4] 0.9,- 3.0, -2.0,-----,----- 1.1, ----,-----, -2.0, -2.0 1.9, -2.0, -2.0,-----,----- 2.1, ----,-----,--1.0, -2.0 2.9, -2.0, -1.0,-----,----- 3.1, ----,-----, -3.0, -2.0
By giving offsets of the equal size in the positive and negative, adjustment of the x-axis label position can be simplified.
p.s. these methods seem to be tricky. I expect that "grouping function" will be improved in the next version of Origin.
|
|
|
Laurie
USA
404 Posts |
Posted - 03/12/2003 : 10:01:47 AM
|
The data arrangement that you used works quite well. I agree that it is a bit tricky. I've added your comments to our development database, so that our programmers can consider better support in the next version. Thank you.
OriginLab Technical Support |
|
|
|
Topic |
|
|
|