T O P I C R E V I E W |
alkamid |
Posted - 05/27/2010 : 09:54:16 AM 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 |
3 L A T E S T R E P L I E S (Newest First) |
alkamid |
Posted - 06/01/2010 : 11:44:45 AM 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. |
alkamid |
Posted - 05/27/2010 : 4:39:53 PM 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. |
greg |
Posted - 05/27/2010 : 11:57:45 AM 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);
|
|
|