Search in sources :

Example 1 with DoubleData

use of uk.ac.sussex.gdsc.core.utils.DoubleData in project GDSC-SMLM by aherbert.

the class CmosAnalysis method showHistogram.

private static void showHistogram(String name, double[] values, int bins, Statistics stats, WindowOrganiser wo) {
    final DoubleData data = DoubleData.wrap(values);
    final double minWidth = 0;
    final int removeOutliers = 0;
    final int shape = Plot.CIRCLE;
    final String label = String.format("Mean = %s +/- %s", MathUtils.rounded(stats.getMean()), MathUtils.rounded(stats.getStandardDeviation()));
    final HistogramPlot histogramPlot = new HistogramPlotBuilder(TITLE, data, name).setMinBinWidth(minWidth).setRemoveOutliersOption(removeOutliers).setNumberOfBins(bins).setPlotShape(shape).setPlotLabel(label).build();
    histogramPlot.show(wo);
    // Redraw using a log scale. This requires a non-zero y-min
    final Plot plot = histogramPlot.getPlot();
    final double[] limits = plot.getLimits();
    plot.setLimits(limits[0], limits[1], 1, limits[3]);
    plot.setAxisYLog(true);
    plot.updateImage();
}
Also used : HistogramPlot(uk.ac.sussex.gdsc.core.ij.HistogramPlot) Plot(ij.gui.Plot) HistogramPlot(uk.ac.sussex.gdsc.core.ij.HistogramPlot) HistogramPlotBuilder(uk.ac.sussex.gdsc.core.ij.HistogramPlot.HistogramPlotBuilder) DoubleData(uk.ac.sussex.gdsc.core.utils.DoubleData)

Aggregations

Plot (ij.gui.Plot)1 HistogramPlot (uk.ac.sussex.gdsc.core.ij.HistogramPlot)1 HistogramPlotBuilder (uk.ac.sussex.gdsc.core.ij.HistogramPlot.HistogramPlotBuilder)1 DoubleData (uk.ac.sussex.gdsc.core.utils.DoubleData)1