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
 Changing symbols for different plots in a graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fabif

Germany
12 Posts

Posted - 07/04/2014 :  06:02:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8G SR6
Operating System: Windows 7

I want to plot data from a datasheet in a graph and change the symbol of every second plot to an open symbol.
The "set %C -k 1;" is not working.
Even the option with range does only work for the first two plots:
range r2 = [Fit vs Original T=200C]Layer1!2;
set r2 -kf 1;

My script so far:

plotxy iy:=(1,11)[1:11] plot:=201 color:=1;
page.longname$="Fit vs Original T=200C";
set %C -k 1;
win -a Book12;
plotxy iy:=(1,12)[12:22] plot:=201 color:=1 ogl:=[Fit vs Original T=200C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200C]1!;
win -a Book12;
plotxy iy:=(1,12)[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200C]1!;
win -a Book12;
plotxy iy:=(1,12)[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,12)[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200C]1!;

Someone an idea?
Thank you!

Edited by - fabif on 07/04/2014 06:50:20 AM

Kathy_Wang

China
159 Posts

Posted - 07/07/2014 :  05:11:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Unfortunately this is a limitation with LabTalk, that for set -kf, it cannot distinguish data plot from different sub ranges of the same column, that's why only the first two plots can be changed in your script. This has been reported to our bug-tracking database with reference ID ORG-11505.

Right now in order to make your script work, you would have to duplicate the source data of each plot to be a set of new column(s), and plot from different columns to make sure set %C -kf command works as expected.

Kathy
Originlab
Go to Top of Page

greg

USA
1378 Posts

Posted - 07/08/2014 :  4:31:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
First: I think there was a typo in your original script that resulted in rows 12:22 of column 12 being plotted twice an rows 1:11 not at all.

Second: While the first instance of plotxy creates a graph window and makes it active, using plotxy with an existing graph does NOT make it active, so only your first "win -a Book12" does anything.

Third: Adding additional data ranges to a plot does NOT change the active dataset, so %C will be constant in your case.

Fourth: Setting plot attributes should be done with the plot active.

There is an option in the SET command to set a special point by index:
set dataset index option value
This version of the SET command does have some 'quirks' (bugs?) when used with sub-ranges of the same dataset. You can workaround the quirks to get a graph that (I think) looks like you want:

// BEGIN SCRIPT
range raA = (1,11); // Using range, plot can remain active
range raB = (1,12);
str$ = nameof(raB)$;
plotxy iy:=(1,11)[1:11] plot:=201 color:=1;
page.longname$="Fit vs Original T=200C";
plotxy iy:=raB[1:11] plot:=201 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raA[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raB[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raA[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raB[23:33] plot:=201 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raA[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200C]1!;
plotxy iy:=raB[34:44] plot:=201 ogl:=[Fit vs Original T=200C]1!;
loop(ii,1,44) {set %(str$) ii -kf 1;};
loop(ii,1,11) {set %(str$) ii -c 1;};
loop(ii,12,22) {set %(str$) ii -c 2};
loop(ii,23,33) {set %(str$) ii -c 3};
loop(ii,34,44) {set %(str$) ii -c 4};
// END SCRIPT

The Quirks:
The first loop sets the open symbol, but resets all the color to Black. Additionally, it makes 44 special symbols for each of the four plotted ranges of this data.
The second, third and fourth loop correct the colors. Again, the command acts on each of the four sub-ranges.
Go to Top of Page

fabif

Germany
12 Posts

Posted - 07/15/2014 :  08:07:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you!
Everything seems to work except the loop.
I suppose that the string expression substitution "%(str$)" is not working within a loop?
quote:

loop(ii,1,44) {set %(str$) ii -kf 1;};
loop(ii,1,11) {set %(str$) ii -c 1;};
loop(ii,12,22) {set %(str$) ii -c 2};
loop(ii,23,33) {set %(str$) ii -c 3};
loop(ii,34,44) {set %(str$) ii -c 4};

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