Drawing on a graph in Igor Pro
The draw layers sit above or below the data and take plain coordinates.
Function MarkThreshold(Variable level)
SetDrawLayer/K UserFront
SetDrawEnv xcoord=prel, ycoord=left, dash=3, linefgc=(0, 0, 65535)
DrawLine 0, level, 1, level
SetDrawEnv xcoord=prel, ycoord=prel, textrgb=(0, 0, 65535)
DrawText 0.02, 0.08, "threshold " + num2str(level)
End
How it works
SetDrawLayerpicks the layer; UserFront is above the traces.SetDrawEnvsets the state for the next object only.xcoord=prelmeans a fraction of the plot area rather than data units.
Keywords and builtins used here
DrawLineDrawTextEndFunctionSetDrawEnvSetDrawLayerVariablenum2str
The run, in numbers
- Lines
- 9
- Characters to type
- 274
- Tokens
- 69
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 49 seconds.
Step 2 of 4 in Marking it up, step 13 of 19 in Graphs & presentation.