Offsets and multipliers in Igor Pro
A trace can be shifted and scaled for display without touching the data.
Function OffsetStack()
String traces = TraceNameList("", ";", 1)
Variable i, n = ItemsInList(traces)
for (i = 0; i < n; i += 1)
String name = StringFromList(i, traces)
ModifyGraph offset($name)={0, i * 1.5}
ModifyGraph muloffset($name)={0, 1}
endfor
SetAxis/A left
End
How it works
offset(trace)={dx, dy}moves it;muloffsetscales it first.- The wave keeps its values; only the drawing changes.
- That is how a stacked plot avoids making four copies of the data.
Keywords and builtins used here
EndFunctionItemsInListModifyGraphSetAxisStringStringFromListTraceNameListVariableendforfori
The run, in numbers
- Lines
- 12
- Characters to type
- 270
- Tokens
- 76
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 54 seconds.
Step 3 of 6 in Styling, step 8 of 19 in Graphs & presentation.