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
 Scripting multiple plots
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

It251

United Kingdom
7 Posts

Posted - 01/15/2020 :  4:30:50 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am trying to script multiple plots at once, but I am hitting a wall. I need to plot series of 10 Y columns at a time, so:

plotxy (?,1:20) plot:=200; // Plot all Y columns in range (1-20)

However, if I try to script several lines at a time:

plotxy (?,1:20) plot:=200; // Plot all Y columns in range (1-20)
plotxy (?,21:40) plot:=200; // Plot all Y columns in range (21-40)
...

It executes the first line, but I receive the following message:
Bad argument, iy:=(?,21:40)

Any way around this?

It251

yuki_wu

896 Posts

Posted - 01/16/2020 :  04:22:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi It251,

If you don’t specify the book ans sheet name, it always means to plot the data the active worksheet. If you run the script:
plotxy (?,1:20) plot:=200;

a graph window will be created and activated. Then you run the script after that:
plotxy (?,21:40) plot:=200;

it won’t work since the current active window is a graph window now.

Regards, Yuki
OriginLab

Edited by - yuki_wu on 01/16/2020 04:22:49 AM
Go to Top of Page

It251

United Kingdom
7 Posts

Posted - 01/16/2020 :  09:54:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much Yuki, is there anyway around that?

Another option I'm contamplating is doing a contour plot. I have a large number of XY columns and I'd like to plot them with the column number (of comments as this is the same thing) as Z. Can this be done?

Regards

It251
Go to Top of Page

yuki_wu

896 Posts

Posted - 01/16/2020 :  9:41:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi It251,

It seems that you have data like XYXYXY…Z (multiple XY and single Z), right? If so:

//Get active workbook name
string wbook_name$ = page.name$;
//Get active worksheet name
string wsheet_name$ = wks.name$;
//Get the number of columns of active worksheet
int ncols = wks.ncols;
int nIteration = (nCols - 1)/2; 
//Loop over all columns except the last Z column
for(int ii = 1; ii <= nIteration; ii++) {
	int nXIndex = ii * 2 -1;
	int nYIndex = ii * 2;
	//Activate workbook
	win - a %(wbook_name$);
	//Activate worksheet
	page.active$ = wsheet_name$;
	//Plot contour
	plotxyz iz:=($(nXIndex),$(nYIndex),$(ncols)) plot:=243 ogl:=<new template:=Contour>; 
}

Hope it helps.

Regards, Yuki
OriginLab

Edited by - yuki_wu on 01/16/2020 9:41:17 PM
Go to Top of Page

It251

United Kingdom
7 Posts

Posted - 01/17/2020 :  12:50:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

Thank you very much for the suggestion. However "data like XYXYXY…Z (multiple XY and single Z)" is not quite what I got. I have 110 times (XY) data and every Y column is labelled (1,2,3,...).

I would like to plot the first 10 (XY) columns in one graph, and then the next 10, and then the next 10 and so on.

Something like:
plotxy (?,1:20) plot:=200; // Plot all Y columns in range (1-20)

and then

plotxy (?,21:40) plot:=200; // Plot all Y columns in range (21-40)

and then

plotxy (?,41:60) plot:=200; // Plot all Y columns in range (41-60)

and then
... until columns X219, Y220


(the contour plot idea was a way of going round this, but I don't have a Z column so it wouldn't work)

Many thanks

It251
Go to Top of Page

yuki_wu

896 Posts

Posted - 01/19/2020 :  12:32:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi It251,

Activate the workbook window before using plotxy command evey time, like:

//Get active workbook name
string wbook_name$ = page.name$;
//Get active worksheet name
string wsheet_name$ = wks.name$;
//Activate workbook
win - a %(wbook_name$);
//Activate worksheet
page.active$ = wsheet_name$;
plotxy (?,1:20) plot:=200;
//Activate workbook and worksheet

Regards, Yuki
OriginLab
Go to Top of Page

It251

United Kingdom
7 Posts

Posted - 01/20/2020 :  04:52:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

That is exactly what I was missing. Thank you so much!!!

Regards

It251
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