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
 To create graphs directly from script

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
pcvolkmar Posted - 08/26/2005 : 06:29:57 AM
Origin Version (Select Help-->About Origin):
Operating System: win 2000

for example I have this table with this values:

A(X) B(Y) C(Y) D(Y)
-------------------------
1 12 19 23
2 23 28 45
3 34 37 01
4 45 45 73
5 56 54 09

and my Script is so:
%W=%H;
win -a %W;
worksheet -s 2 0 4 0; # axis x: col2 ,axis y: col4
worksheet -p 201 scatter;
layer -i %W;
win -a Graph1;

win -a %W;
worksheet -s 2 0 3 0;#axis x:col2 , axisy:col3
worksheet -p 201 scatter;
layer -i %W;
win -a Graph2;

the result that I obtain is not the awaited one
I obtein in each graph more than a linear representation:

for example:
win -a %W;
worksheet -s 4 0 3 0;#axis x:col4, axisy:col3
worksheet -p 201 scatter;
layer -i %W;
win -a Graph2;

(x,y):col1,col4
(x,y): col1,col3
And it does not correspond to the axes that I have put behind the commentaries.
I want:
(x,y): col4,col3

I wish a single linear representation of two columns,these representation no depend on col1.

Thanks a lot,
Volkmar.
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 08/26/2005 : 08:43:27 AM
Hi,

The command 'worksheet -s 2 0 3 0' selects columns 2 and 3 but does not make column 2 an X column. You must first assign an X column and then use worksheet -s to select the Y columns you want to plot against it...

%W=%H;
win -a %W;
wks.col1.type=2; // disregard col A... you need only one X column
wks.col2.type=4; // make col B an X column... B(X)
worksheet -s 4 0 4 0; // select Y col 4 for plotting
worksheet -p 201 scatter;
//layer -i %W; // this makes no sense
//win -a Graph1; // graph should already be active

win -a %W;
worksheet -s 3 0 3 0; // select Y col 3 for plotting
worksheet -p 201 scatter;
//layer -i %W;
//win -a Graph2;

Your last example (where col 4 is X) is more complicated. A wks can have more than one X column but a Y column will always be plotted against the closest X column on the left. Therefore you can't plot col 3 vs col 4. You need to move one of those columns...

win -a %W;
wo -a 1; // add a column (E) on the right
col(5)=col(3); // copy col C to E
wks.col4.type=4; // D(Y)-->D(X)
worksheet -s 5 0 5 0; // select col E
wo -p 201 scatter; // plot col E(Y) vs col D(X2)

...That last script won't work because col(D) is used as a Y column earlier. Also, the 01 entry at row 3 of col(D) causes the column to be formatted as text so the plot will not look right. I think the following is what you want.

%W=%H;
//win -a %W; // not necessary, %H is already active
loop (i,1,4) {wks.col$(i).format=1}; // format col as numeric (01-->1)
wks.col1.type=2; // disregard col A
wks.col2.type=4; // make col B an X column... B(X)
worksheet -s 4 0 4 0; // select Y col 4 for plotting
worksheet -p 201 scatter; // plot C(Y) vs B(X)

win -a %W;
worksheet -s 3 0 3 0; // select Y col 3 for plotting
worksheet -p 201 scatter; // plot D(Y) vs B(X)

win -a %W;
wo -a 2; // add 2 cols (E and F) on the right
col(5)=col(4); // copy col D to E
col(6)=col(3); // copy col C to F
wks.col5.type=4; // E(Y)-->E(X2)
worksheet -s 6 0 6 0; // select col 6 (F)
wo -p 201 scatter; // plot F(Y2) vs E(X2)

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/26/2005 09:09:59 AM

Edited by - Mike Buess on 08/28/2005 1:10:49 PM

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