use of ij.gui.Plot2 in project GDSC-SMLM by aherbert.
the class PCPALMMolecules method plot.
private double[][] plot(DoubleData stats, String label, boolean integerBins) {
String title = TITLE + " " + label;
Plot2 plot;
double[][] hist = null;
if (integerBins) {
// The histogram is not need for the return statement
Utils.showHistogram(title, stats, label, 1, 0, 0);
} else {
// Show a cumulative histogram so that the bin size is not relevant
hist = Maths.cumulativeHistogram(stats.values(), false);
// Create the axes
double[] xValues = hist[0];
double[] yValues = hist[1];
// Plot
plot = new Plot2(title, label, "Frequency", xValues, yValues);
Utils.display(title, plot);
}
return hist;
}
use of ij.gui.Plot2 in project GDSC-SMLM by aherbert.
the class PCPALMAnalysis method plotCorrelation.
public static Plot2 plotCorrelation(double[][] gr, int offset, String plotTitle, String yAxisTitle, boolean barChart, boolean showErrorBars) {
double[] x = new double[gr[1].length - offset];
double[] y = new double[x.length];
System.arraycopy(gr[0], offset, x, 0, x.length);
System.arraycopy(gr[1], offset, y, 0, y.length);
Plot2 plot = new Plot2(plotTitle, "r (nm)", yAxisTitle);
plot.setLimits(0, x[x.length - 1], Maths.min(y) * 0.95, Maths.max(y) * 1.05);
plot.addPoints(x, y, (barChart) ? Plot2.BAR : Plot.LINE);
Utils.display(plotTitle, plot);
if (showErrorBars && !barChart) {
plot.setColor(Color.magenta);
for (int i = 0; i < x.length; i++) {
double sd = gr[2][i + offset];
plot.drawLine(x[i], y[i] - sd, x[i], y[i] + sd);
}
Utils.display(plotTitle, plot);
}
return plot;
}
Aggregations