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

coll@inia.

Spain
125 Posts

Posted - 06/07/2015 :  11:40:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. Originpro 2015 and Service Release (Select Help-->About Origin):
Operating System:WIN8

As a result of a Labtalk script, I have the following data, were mean1 represents negative values from several sera while mean2 represents positive values from positive sera, both of which I want to plot in an scatter template for comparison.

(X) XX1(Y) mean1(Y) sd1(Y) XX2(Y) mean2(Y) labeled(Y)
1
2
3
4
5
6
7
8
9
10

I used the following script:

//changing col types
range rr1=!col(XX1);
rr1.type=4;
range rr2=!col(sd1);
rr2.type=3;
range rr3=!col(XX2);
rr3.type=4;
range rr4=!col(sd2);
rr4.type=3;
range rr5=!col(labeled);
rr5.type=5;

//fill out XX1 and XX2 with X numbers to be plot
for(jj=1;jj<=10;jj++){col(XX1)[jj]=1;};
for(jj=1;jj<=10;jj++){col(XX2)[jj]=2;};

//plot
type -c plot scatter;
range rango=Col(XX1):Col(labeled);
plotxy rango plot:=201;

However the data is automatically plotted against the first X default values. The rest of the new X axes are considered as they were still Y. I also tried to plot into a template but the same problem appears.

By the way the same data drawn by hand, results in the appropiatted graphic !!!!!!

I would prefer to avoid rows >10 which contain some irrelevant data, but that is well beyond my attempts..................

Could anyone help me?
Thanks, julio

jasonzhao

China
262 Posts

Posted - 06/07/2015 :  9:57:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I notice you use the script below:

range rr2=!col(sd1);
rr2.type=3;

In fact, type 3 is not Y but Y Error, if you want a XY plot, you need to have a Y column.
You can try to use range.type=1 instead of range.type=3.

range rr2=!col(sd1);
rr2.type=1;



Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 06/07/2015 9:59:09 PM
Go to Top of Page

coll@inia.

Spain
125 Posts

Posted - 06/08/2015 :  01:11:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Jason, but that is what I needed !!
I need XX1 and XX2 to be X axes while sd1 and sd2 required to be treated as Y errors and labeled as a label type.

They all were changed by the script, but the plotxy did not plotted those as such but all as Y axes.

What I do not understand is that plotting those by selecting and plotting scatter manually rather than by the script, resulted in the correct graphic.

Best, julio
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 06/08/2015 :  01:56:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Julio,

If you want to plotxy with error bar, you can use the syntax like this:

plotxy ((2,3,4),(5,6,7)) plot:=201;
//plot column 2, 3 as XY, 4 as error, same for 5, 6, and 7


Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

coll@inia.

Spain
125 Posts

Posted - 06/08/2015 :  04:35:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you again Jaso!

However, I cannot use col numbers because the calculations differ according to data and it is difficult to make those scripts with variables instead, at least I do not know how. I though it will be easier to use col names instead.
Also I need tp plot not only the y error but also each of the row labels to recognize which point has each value in the graphic.

Do you know any other trick?

Thanks again, julio
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 06/09/2015 :  04:09:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,
Please see the examples below:

//we can use the long name instead of index
plotxy iy:=((col(xx1),col(mean1),col(sd1)),(col(xx2),col(mean2),col(sd2)));
//keep the graph active
set %C -q 1; //set the Label on
set %C -qm 5; // set the label form to be customized
%A=$;
set %c -qms %A(col(label)[i], .2);  //show data in col(label) as label 


please refer to page below for further information:

http://wikis/ltwiki/index.php?title=LabTalk%3ASet_(command)#-q_value.3B_Turn_the_data_label_on_or_off

(you can search for -q, -qs, -qms)

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 06/09/2015 04:11:43 AM
Go to Top of Page

coll@inia.

Spain
125 Posts

Posted - 06/09/2015 :  2:17:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
GREAT!!!!
SOLVED!
The script seems rather complex but...... it WORKS !!!
Thank you very much, Jason
julio
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