Bar charts in Igor Pro
A bar chart is a trace in a different mode, against a text wave for the categories.
Function BarChart(WAVE counts, WAVE/T names)
DoWindow/K BarView
Display/N=BarView counts vs names
ModifyGraph mode=5, hbFill=2, rgb=(20000, 40000, 60000)
ModifyGraph toMode=0, barGap=0.2, useBarStrokeRGB=1
ModifyGraph barStrokeRGB=(0, 0, 0)
ModifyGraph tkLblRot(bottom)=45, tick(bottom)=3
Label left, "Count"
SetAxis/A/E=1 left
End
How it works
mode=5draws bars;hbFillpicks the fill pattern.- Plotting against a text wave makes the bottom axis categorical.
toModedecides whether bars sit on zero or on the previous trace.
Keywords and builtins used here
DisplayDoWindowEndFunctionLabelModifyGraphSetAxisWAVE
The run, in numbers
- Lines
- 12
- Characters to type
- 333
- Tokens
- 85
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 64 seconds.
Step 4 of 5 in Making a graph, step 4 of 19 in Graphs & presentation.