location conversion: x,y axis values to plot points
s.r.chinn
function info(GraphName,Vx, Vy) // convert an x,y value in graph axis units
string GraphName // to plot region point values
variable Vx, Vy
GetWindow $GraphName gsize // inside of graph window
variable x0=V_left, x1 = V_right, y0 = V_top, y1 = V_bottom
GetWindow $GraphName psize // plot region of graph
variable x2 = V_left, x3 = V_right, y2 = V_top, y3 = V_bottom
GetAxis/Q /W=$GraphName left // left axis range
variable VB = v_min, VT = v_max
GetAxis/Q /W=$GraphName bottom // bottom axis range
variable VL = v_min, VR = v_max
variable Vpx = ((Vx-VL)/(VR-VL))*(x3-x2) + (x2-x0) // x (points) right from bottom axis min
variable Vpy = ((VT-Vy)/(VT-VB))*(y3-y2) + (y2-y0) // y (points) down from left axis max
Make/O/N=2 W_Vpoint = {Vpx, Vpy} // globally accessible result wave
end
string GraphName // to plot region point values
variable Vx, Vy
GetWindow $GraphName gsize // inside of graph window
variable x0=V_left, x1 = V_right, y0 = V_top, y1 = V_bottom
GetWindow $GraphName psize // plot region of graph
variable x2 = V_left, x3 = V_right, y2 = V_top, y3 = V_bottom
GetAxis/Q /W=$GraphName left // left axis range
variable VB = v_min, VT = v_max
GetAxis/Q /W=$GraphName bottom // bottom axis range
variable VL = v_min, VR = v_max
variable Vpx = ((Vx-VL)/(VR-VL))*(x3-x2) + (x2-x0) // x (points) right from bottom axis min
variable Vpy = ((VT-Vy)/(VT-VB))*(y3-y2) + (y2-y0) // y (points) down from left axis max
Make/O/N=2 W_Vpoint = {Vpx, Vpy} // globally accessible result wave
end
Caution: tested on Windows 7 only
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More