
draw a line on a graph

tony
function ACW_DrawLine() string str_Axis="", str_AxisList="", str_layers="ProgBack;UserBack;ProgAxes;UserAxes;ProgFront;UserFront" variable pos, var_layer=2 if (!strlen(WinList("*", ";","WIN:1"))) doalert 0, "No graph window" return 0 endif getaxis /Q left if (V_flag<1) str_AxisList+="left;" endif getaxis /Q bottom if (V_flag<1) str_AxisList+="bottom;" endif getaxis /Q right if (V_flag<1) str_AxisList+="right;" endif getaxis /Q top if (V_flag<1) str_AxisList+="top;" endif prompt str_Axis, "Choose an axis: ", popup, str_AxisList prompt pos, "Position: " prompt var_layer, "Choose drawing layer: ", popup, str_layers DoPrompt "Draw a line on the graph", str_Axis, pos, var_layer if (V_Flag) return 0 // user canceled endif SetDrawLayer $stringfromlist(var_layer, str_layers) strswitch(str_Axis) case "left": setdrawenv xcoord=prel, ycoord=$str_Axis drawline 0,pos,1, pos break case "right": setdrawenv xcoord=prel, ycoord=$str_Axis drawline 0,pos,1, pos break default: setdrawenv ycoord=prel, xcoord=$str_Axis drawline pos,0,pos,1 endswitch end

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
And then I found that I had to add support for perpendicular axes that didn't completely span the plot area. :-)
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
June 28, 2012 at 12:37 pm - Permalink