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 for Programming
 LabTalk Forum
 Changing symbols for different plots in a graph

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
fabif Posted - 07/04/2014 : 06:02:54 AM
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=200°C]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=200°C";
set %C -k 1;
win -a Book12;
plotxy iy:=(1,12)[12:22] plot:=201 color:=1 ogl:=[Fit vs Original T=200°C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200°C]1!;
win -a Book12;
plotxy iy:=(1,12)[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200°C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200°C]1!;
win -a Book12;
plotxy iy:=(1,12)[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200°C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,11)[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200°C]1!;
set %C -kf 1;
win -a Book12;
plotxy iy:=(1,12)[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200°C]1!;

Someone an idea?
Thank you!
3   L A T E S T    R E P L I E S    (Newest First)
fabif Posted - 07/15/2014 : 08:07:29 AM
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};

greg Posted - 07/08/2014 : 4:31:17 PM
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=200°C";
plotxy iy:=raB[1:11] plot:=201 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raA[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raB[12:22] plot:=201 color:=2 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raA[23:33] plot:=201 color:=3 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raB[23:33] plot:=201 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raA[34:44] plot:=201 color:=4 ogl:=[Fit vs Original T=200°C]1!;
plotxy iy:=raB[34:44] plot:=201 ogl:=[Fit vs Original T=200°C]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.
Kathy_Wang Posted - 07/07/2014 : 05:11:41 AM
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

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