typestar

Histograms in Igor Pro

Histogram fills a destination wave whose scaling becomes the bin axis.

Function BuildHistogram(WAVE w)
    WaveStats/Q w
    Variable width = (V_max - V_min) / 50

    Make/O/N=50/D hist
    Histogram/B={V_min, width, 50}/Dest=hist w

    Variable mode = DimOffset(hist, 0) + DimDelta(hist, 0) * V_maxloc
    return mode
End

How it works

  1. /B={start, width, count} sets the bins explicitly.
  2. /Dest= names the output, which Igor scales for you.
  3. The result is an ordinary wave, so everything else applies to it.

Keywords and builtins used here

The run, in numbers

Lines
10
Characters to type
229
Tokens
61
Three-star pace
80 tpm

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

Type this snippet

Step 2 of 3 in Measuring, step 6 of 16 in Waves & analysis.

← Previous Next →

Histograms in other languages