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
 Origin Forum
 How to add a right y axis as a function of y1?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

olgpacc

USA
1 Posts

Posted - 10/27/2011 :  10:26:26 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi All,

I am new to OriginLab. The questions I am having are described below.

I am trying to add a right y axis (called y2) onto a normal x-y1 plot.

The each value of y2 is related to the corresponding value of y1. For example, y2(i) = [y1(i) - y1(1)] * 10 where I use "i" to represent the row index in the workbook.

After turning on the right y axis, I tried to use the following script: layer.y2.label.formula$=col(B) * 10.

I don't know how to do [y1(i) - y1(1)] in the script. However, I don't get any label on the right y axis even after using col(B) * 10.

I think I need your help. Any suggestion?


Origin Ver. 8.5.1 and Service Release 2
Operating System: Windows 7

Drbobshepherd

USA
Posts

Posted - 10/28/2011 :  3:13:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I see a couple of problems:
(1) Your statement, layer.y2.label.formula$=col(B)*10, has a variable type mismatch eror. It has a string variable on the left of the assignment operator(=), and a numeric expression on the other. You need to fix that.

(2) About your expression, y1(i)-y1(1), you need to use square brackets to address individual cells; parentheses are used to indicate linear interpolated values.

I don't know if these tips will solve your problem. I suggest you create a new column, select the column, and use the pull-down command, Column:Set Column Values to define your new function, y2.
Then add y2 to your plot.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 10/28/2011 :  4:03:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi olgpacc,

You can try the following script (assuming that your Y1 data is in column B in Book1):

  range rb=[book1]sheet1!col(B);
  a0=rb[1];
  layer.y2.label.formula$="(x-a0)*10";

I hope this is what you wanted.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 10/28/2011 4:10:02 PM
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