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 for Programming
 LabTalk Forum
 Plotting different datasets in layers!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rrahul

USA
Posts

Posted - 01/21/2005 :  1:04:50 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): ver 7.0
Operating System: Windows XP
I have been going through your forums for weeks now and found the material really helpful. Thank you for that.
Now, I am trying to customize a rountine to generate plots in a userdefined graph template. I want to plot the data into layer 1 and the histogram of one of the columns in layer2. here's the code, I was wondering if you can tell what I am doing wrong.
Thanks,
Rahul

[Main]
FDLOG.multiopen.colview=12; // new property for dialog options
FDLOG.UseGroup(Ascii); //Open ASCII files
if (FDLOG.multiopen()==0/0)
return 1;

loop(ii,1,FDlog.MultiOpen.Count)
{
FDlog.Get(A, ii);
win -t data;
open -w %A;

run.section(,Plot,%H); //Run Plot section

}


[Plot]
win -t plot TraceHistogram; //customized template
page.active=1; // activate layer 1
layer -w %1 0201 line; //Include wks data in the active layer
set %1_b -cl 4;
set %1_c -cl 2;

%R=histogram(%1_b, 0.03, 0.009, 1.00); //Hgram Fret values
page.active=2; // activate layer 2
layer -i %R column;
return 0;


Mike Buess

USA
3037 Posts

Posted - 01/21/2005 :  1:35:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. First problem is with this line...

layer -w %1 0201 line;

The correct syntax is

layer -w wksName c1 r1 c2 r2 graphtype;
c1 is first col
r1 is first row
c2 is last col
r2 is last row

You've supplied wksName as %1... OK
Your indices need to be space-separated and they might be in the wrong order.
Graphtype should be a code, not string. (line is 200, see wo -p command)

2. Next problem is that %R has not been defined in the line

%R=histogram(%1_b, 0.03, 0.009, 1.00);

Should specify a particular column is a named wks, such as %R=%1_R. (Maybe you did that somewhere else in your script.)


3. Last problem is similar to first...

layer -i %R column;

Should be layer -i %R 203;

Mike Buess
Origin WebRing Member
Go to Top of Page

rrahul

USA
Posts

Posted - 01/21/2005 :  4:49:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike for the prompt reply. I got the first layer to plot my trace without any major modifications but can't seem to get the histogram to work. I must be assigning my dataset incorrectly. Could you please show me how to select a column from a worksheet, build a histogram for the data set and plot it in the second layer.
Thanks,
Rahul

Edited by - rrahul on 01/21/2005 4:52:42 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/21/2005 :  5:50:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Rahul,

Since the two layers will have different X axes I suggest you create a separate worksheet to hold all histogram data...

[Main]
FDLOG.multiopen.colview=12; // new property for dialog options
FDLOG.UseGroup(Ascii); //Open ASCII files
if (FDLOG.multiopen()==0/0)
return 1;

win -t D; // create histogram wks
%N=%H; // remember its name
col(A)=data(0.009,1,0.03); // create X axis using your histogram settings
wo -a FDlog.MultiOpen.Count-1; // add necessary # of Y columns

loop(ii,1,FDlog.MultiOpen.Count)
{
FDlog.Get(A, ii);
win -t data;
open -w %A;

run.section(,Plot,%H); //Run Plot section

}

[Plot]
win -t plot TraceHistogram; //customized template
page.active=1; // activate layer 1
// plot layer 1 (don't know what you ended up with but insert it here)

// now plot layer 2
page.active=2;
%(%N,ii+1)=histogram(%1_b,0.03,0.009,1); // create histogram dataset
lay -i203 %(%N,ii+1); // plot as columns (my previous correction was wrong)

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/21/2005 5:51:38 PM

Edited by - Mike Buess on 01/21/2005 5:55:54 PM
Go to Top of Page

rrahul

USA
Posts

Posted - 01/28/2005 :  12:03:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,
Thanks for the help. Got everything working!!
I am attaching the code incase somebody else has similar problem.
Thanks once again.

-rahul

[Main]
FDLOG.multiopen.colview=12; // new property for dialog options
FDLOG.UseGroup(Ascii); //Open ASCII files
if (FDLOG.multiopen()==0/0)
return 1;

loop(ii,1,FDlog.MultiOpen.Count)
{
FDlog.Get(A, ii);
win -t data;
open -w %A;
%W = %H; /* save worksheet name */

getenumwks Count; // open a worksheet template called Count
%N=%H; //remember its name
ClearWorksheet %H;
min = 0;
max = 1.0;
inc = 0.025;

col(1)=data(min+(1/2)*inc,max+(1/2)*inc,inc);
/* X column for the new worksheet. Note that this must
* be done before the sum function is called again.
* Also, this actually may create one more point than
* is needed. */

run.section(,Plot,%W); //Run Plot section


}


[Plot]

win -t plot TraceHistogram G%W; //customized template
page.active=1; // activate layer 1
layer -w %1 0201 200; //Include wks data in the active layer
set %1_b -cl 4;
set %1_c -cl 2;



page.active=2; // activate layer 2
%(%N,ii+1)=histogram(%1_b,0.025,0.0,1); // create histogram dataset
set %N -e 40; /* to make sure all columns have the same size */
layer -i %N_count; // plot as columns

layer -a;
return 0;
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