typestar

Making a graph in Igor Pro

Display opens a window on a wave; everything after that names the window.

Function ShowTrace(WAVE y, WAVE x)
    DoWindow/K TraceGraph
    Display/N=TraceGraph/W=(50, 50, 550, 400) y vs x

    AppendToGraph/R y

    String traces = TraceNameList("TraceGraph", ";", 1)
    Printf "%d traces on %s\r", ItemsInList(traces), WinName(0, 1)
End

How it works

  1. Display y vs x plots one against the other; without vs it uses scaling.
  2. /N= names the window so later commands can find it again.
  3. DoWindow/K closes an old one first, which makes a script re-runnable.

Keywords and builtins used here

The run, in numbers

Lines
9
Characters to type
244
Tokens
59
Three-star pace
80 tpm

At the three-star pace of 80 tokens a minute, this run takes about 44 seconds.

Type this snippet

Step 1 of 5 in Making a graph, step 1 of 19 in Graphs & presentation.

Next →