//vischer@uva.nl //21.08.18 14:44 //Creates a histogram from an array or Results column macro "Histogram Plot" { columnTitle = "Demo";// you can replace "Demo" by an existing column title binWidth = 0;//use 0 for auto-binning binCenter = 0; if (columnTitle == "Demo") createDemoColumn(); values = Table.getColumn(columnTitle); Array.getStatistics(values, min, max, mean, stdDev); close("Histogram Demo"); Plot.create("Histogram " + columnTitle, columnTitle, "Freq"); Plot.setColor("blue", "#ddddff"); Plot.addHistogram(values, binWidth, binCenter); Plot.setLimits(NaN, NaN, 0, NaN); stats ="n= "+ values.length + "\nMean= "+mean + "\nStDev= " + stdDev; Plot.addText(stats, 0.02, 0.1); Plot.show(); } //put normal distribution into column "Demo" function createDemoColumn(){ random("seed", 0); newImage("Random Img", "32-bit noise", 2000, 1, 1); run("Select All"); values = getProfile;//fills array with normal distribution close; Table.setColumn("Demo", values); Table.update; }