// Creates a virtual hyperstack of frozen plots. // Use the sliders to change sigma and amplitude. // Author: Norbert Vischer macro "Plot Family 2D" { close("*", "keep"); close("*.ijm", "keep"); left = 0; right = 4; bottom = 0; top = 1.5; nPoints = 100; range = right - left; x0 = 2; Plot.create("Plot Family 2D", "X", "Y"); Plot.setLimits(left, right, bottom, top ); Plot.setFrameSize(800, 500); Plot.setFontSize(18); numFrames = 0; for (sigma = 0.2; sigma <0.6; sigma +=0.03){ showProgress((sigma - 0.2)/0.4); numFrames ++; numSlices = 0; for (ampl = 1; ampl < 1.5; ampl += 0.03){ numSlices++; xValues = newArray(nPoints);//start building one member yValues = newArray(nPoints); for (p = 0; p < nPoints; p++) { x = p/nPoints * range + left; xValues[p] = x; yValues[p] = ampl * exp(-pow(x - x0, 2)/(sigma * sigma * 2)); } Plot.setLineWidth(2); Plot.setColor("#555555", "#eeeeee"); Plot.setColor("#ddddff"); Plot.add("filled", xValues, yValues); Plot.setColor("black"); Plot.add("line", xValues, yValues); txt = "Sigma: " + d2s(sigma, 2); txt += "\nAmplitude: " + d2s(ampl, 2); txt += "\n(use sliders to change)"; Plot.setColor("red"); Plot.addText(txt, 0.7, 0.1); Plot.setLineWidth(1); Plot.appendToStack; //end building one member } } Plot.show; rename("Adjustable Gaussian Plot"); run("Stack to Hyperstack...", "slices=&numSlices frames=&numFrames"); Stack.getDimensions(width, height, channels, slices, frames) for(i=1; i<=frames; i++) { Stack.setFrame(i) wait(150); } }