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
 All Forums
 Origin Forum
 Origin Forum
 Multiple Automatic Plot Generation

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
frijud Posted - 05/08/2007 : 6:59:26 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System:XPSP2

I have a unique job that I need Orgin to do. I have a set of data that is about 20 columns long. I want to automatically generate plots of:

A vs B
A vs C
A vs D ...and so on

and

B vs C
B vs D ...and so on

Also, after these plot are generated, I want to plot:

A/B vs C/B
A/B vs D/B ...and so on

and

A/C vs B/C
D/C bs B/C ...and so on

I can do all of these plots manually, however it takes HOURS. Is there a way to program a macro to have it automatically generate these plots? Ideally, I would like a linear weighted least squares fit to each plot as well.
5   L A T E S T    R E P L I E S    (Newest First)
larry_lan Posted - 05/09/2007 : 11:01:17 PM
Hi:

I am not sure what you mean "mathmatical opperations", if you want to calculate column A / column B, you can use:

col(c) = col(a)/col(b).

So you may need some more worksheets to save the result A/B, B/C, etc. Try the following script:

[main]
%l=%h;
nWksCols=wks.nCols;
for (ii=2; ii<nWksCols; ii++)
{
run.section(, CreateDataWin);
};
run.section(, PlotGraphs);

[CreateDataWin]
jj = ii;
win -t data origin;
worksheet -a nWksCols-2-ii+1;
nc = wks.ncols;
for(kk=1; kk<=nc; kk++)
{
%(%h, kk) = %(%l, jj);
jj++;
}

win -a %l;
worksheet -d;
nc=wks.ncols;
for(kk=1; kk<=nc; kk++)
{
%(%h,kk) = %(%h,kk) / %(%l,ii);
};
delete %(%h, ii);

[PlotGraphs]
doc -e w
{
%o = %h;
nc = wks.ncols;
for (nn=2; nn<=nc; nn++)
{
win -a %o;
worksheet -s nn 0 nn 0;
worksheet -p 201 scatter;
lr %c;
};
};


You can save the whole script as an .OGS file, such as test.ogs, and save this .OGS file to your Origin user folder. To run this .ogs file, type run.section(test, main) in the script window.

P.S. For 20 columns, it will generate hundreds of graph windows. Be careful

Larry
OriginLab Technical Services

Edited by - larry_lan on 05/09/2007 11:02:58 PM
frijud Posted - 05/09/2007 : 2:53:42 PM
I was able to get the command error to go away by changeing the %c with a %b as shown in the code below:

%l=%h;
nWksCols=wks.nCols;
for (ii=1; ii<=nWksCols; ii++)
{
for (jj=ii+1; jj<=nWksCols; jj++)
{
window -t p;
%a= %(%l, $(ii));
%b= %(%l, $(jj));
layer.plotxy(%a, %b);
layer -a;
lr %b; //Linear fit
label -s "Slope is $(lr.b) sigma is $(lr.sdB);
Intercept is $(lr.a) sigma is $(lr.sdA);
R is $(lr.r), stdev of fit is $(lr.sd);
number of points is $(lr.n)";
};
};

Now I just need to figure out how to do the mathmatical opperations. Any advice there?
frijud Posted - 05/09/2007 : 12:08:08 PM
Also,
When I run the script on four columns of data, It generats one plot (A vs B). The other plots aren't there. In the scripts window, after the highlighted code, I get a line added that says "#Command Error!" I don't know what that means.

frijud Posted - 05/09/2007 : 12:02:46 PM
Sorry, A/C vs B/C is column A devided by Column C vs Column B devided by Column B.

I need to do a mathmatical opperation then plot and do a linear fit of the data. I have also been looking at GNUplot. That program will do this qutie nicely, however it is rather hard to work with.

Thanks for you help!

Deanna Posted - 05/08/2007 : 11:42:48 PM
quote:

Origin Version (Select Help-->About Origin): 7.5
Operating System:XPSP2

I have a unique job that I need Orgin to do. I have a set of data that is about 20 columns long. I want to automatically generate plots of:

A vs B
A vs C
A vs D ...and so on

and

B vs C
B vs D ...and so on


Hi, you can use the following Labtalk script to do the graphing and perform linear fit to each plot.


%l=%h;
nWksCols=wks.nCols;
for (ii=1; ii<=nWksCols; ii++)
{
for (jj=ii+1; jj<=nWksCols; jj++)
{
window -t p;
%a= %(%l, $(ii));
%b= %(%l, $(jj));
layer.plotxy(%a, %b);
layer -a;
lr %c; //Linear fit
label -s "Slope is $(lr.b), Intercept is $(lr.a)";
};
};



You can paste the code into the Script Window, highlight it and press Enter to execute it.

quote:

Also, after these plot are generated, I want to plot:

A/B vs C/B
A/B vs D/B ...and so on

and

A/C vs B/C
D/C bs B/C ...and so on



I am sorry. I don't quote understand what you mean by "A/C". Would you please explain?

Deanna
OriginLab Technical Services

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000