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

alkamid

Poland
27 Posts

Posted - 05/27/2010 :  09:54:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: OriginPro 8 SR3
Operating System: Ubuntu 9.04

Hello,

Here's what I want to do:
From the bottom graph (which, in the example picture, is the same as the middle one) I have to choose manually my desired X range (with a zoom tool or with markers). Then I'd like my script to adjust the Y range so that the top/bottom margins are 5% - I guess I'd have to use markers to set a range and let the script find the min/max values of X within that range. Then I want to apply the same range to the top and the middle graphs and within the same range the script should search for Y minima/maxima and adjust the scale.

I know how to link the scales with LabTalk but this is the easy part. I just wanted to know if what I want to do is possible with LabTalk or I should rather use OriginC or maybe it's not possible at all (I hope not).



Regards,
alkamid

greg

USA
1378 Posts

Posted - 05/27/2010 :  11:57:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Once you have set your data range, you can use the limit command :
limit %C;
limit.xmin=;
limit.xmax=;
limit.ymin=;
limit.ymax=;

to get the minimum and maximum x and y values within that range.

You can use layer properties to set the Y display range to have a 5% margin :
Y1 = limit.ymin - .05 * (limit.ymax - limit.ymin);
Y2 = limit.ymax + .05 * (limit.ymax - limit.ymin);


I understood you to mean you wanted the Y scales for the other layers to be set to a similar Y margin for the statistics on the same X range as the primary layer. That would require XINDEX and XINDEX1 functions to know where to set the limits for the other layers. The whole thing might look something like this :

// This layer
limit %C;
Y1 = limit.ymin - .05 * (limit.ymax - limit.ymin);
Y2 = limit.ymax + .05 * (limit.ymax - limit.ymin);

// Next layer
page.active = 2;
bx = xindex(limit.xmin,%C); // What minimal row has this X value
ex = xindex1(limit.xmax,%C); // What maximal row has this X value
set %C -b bx; // Set begin range to minimal row
set %C -e ex; // Set end range to maximal row
limit %C; // Get limit stats
set %C -e; // Restore full range
// Set 5% Y margins
Y1 = limit.ymin - .05 * (limit.ymax - limit.ymin);
Y2 = limit.ymax + .05 * (limit.ymax - limit.ymin);

// Last layer
page.active = 3;
bx = xindex(xmin,%C);
ex = xindex1(xmax,%C);
set %C -bs bx;
set %C -es ex;
limit %C;
set %C -e;
Y1 = limit.ymin - .05 * (limit.ymax - limit.ymin);
Y2 = limit.ymax + .05 * (limit.ymax - limit.ymin);
Go to Top of Page

alkamid

Poland
27 Posts

Posted - 05/27/2010 :  4:39:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
greg, thank you very much for your reply. It seems to be quite what I wanted but there's one hook: I'd like to get x/ymax/min from my graph, not from the whole range. I understand that it's impossible to do it after only zooming in the desired area, but maybe if I set two markers (Data Selector) then I could somehow search for xmin/max between them?

PS The graph at the bottom of my picture when zoomed out looks exactly like the middle one.

Edited by - alkamid on 05/27/2010 4:58:55 PM
Go to Top of Page

alkamid

Poland
27 Posts

Posted - 06/01/2010 :  11:44:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Anyone please? I'm not asking for a complete solution, I just want to know if what I need is possible and what functions may be useful.
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