The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Stock coulumn plots with two grouped data sets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

koshikaw@n

Japan
3 Posts

Posted - 03/09/2003 :  04:41:53 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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);

Go to Top of Page

Laurie

USA
404 Posts

Posted - 03/11/2003 :  11:39:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cjfraz

USA
22 Posts

Posted - 03/11/2003 :  12:09:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

koshikaw@n

Japan
3 Posts

Posted - 03/12/2003 :  02:40:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.


Go to Top of Page

Laurie

USA
404 Posts

Posted - 03/12/2003 :  10:01:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000