typestar

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

  1. SetDrawLayer picks the layer; UserFront is above the traces.
  2. SetDrawEnv sets the state for the next object only.
  3. xcoord=prel means a fraction of the plot area rather than data units.

Keywords and builtins used here

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.

Type this snippet

Step 2 of 4 in Marking it up, step 13 of 19 in Graphs & presentation.

← Previous Next →