/** Sets the plot frame size in (unscaled) pixels. This size does not include the * borders with the axis labels. Also sets the scale to 1.0. * This frame size in pixels divided by the data range defines the image scale. * This method does not check for the minimum size MIN_FRAMEWIDTH, MIN_FRAMEHEIGHT. * Note that the black frame will have an outer size that is one pixel larger * (when plotted with a linewidth of one pixel). */ public void setFrameSize(int width, int height) { if (pp.width <= 0) { //plot not drawn yet? Just remember as preferred size preferredPlotWidth = width; preferredPlotHeight = height; scale = 1.0f; } else { makeMarginValues(); width += leftMargin+rightMargin; height += topMargin+bottomMargin; setSize(width, height); } }
/** Sets the plot frame size in (unscaled) pixels. This size does not include the * borders with the axis labels. Also sets the scale to 1.0. * This frame size in pixels divided by the data range defines the image scale. * This method does not check for the minimum size MIN_FRAMEWIDTH, MIN_FRAMEHEIGHT. * Note that the black frame will have an outer size that is one pixel larger * (when plotted with a linewidth of one pixel). */ public void setFrameSize(int width, int height) { if (pp.width <= 0) { //plot not drawn yet? Just remember as preferred size preferredPlotWidth = width; preferredPlotHeight = height; scale = 1.0f; } else { makeMarginValues(); width += leftMargin+rightMargin; height += topMargin+bottomMargin; setSize(width, height); } }
/** * Create plot with the precision-recall curve * @param stats classification statistics * @return precision-recall plot */ public static Plot createPrecisionRecallPlot( ArrayList< ClassificationStatistics > stats) { // Extract precision and recall values float[] precision = new float[ stats.size() ]; float[] recall = new float[ stats.size() ]; for(int i = 0; i < precision.length; i++) { precision[i] = (float) stats.get(i).precision; recall[i] = (float) stats.get(i).recall; } Plot pl = new Plot("Precision-Recall curve", "Recall [tp / (tp + fn)]", "Precision [tp / (tp+fp)]", recall, precision); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.GREEN); return pl; }
/** * Create plot with the precision-recall curve * @param stats classification statistics * @return precision-recall plot */ public static Plot createPrecisionRecallPlot( ArrayList< ClassificationStatistics > stats) { // Extract precision and recall values float[] precision = new float[ stats.size() ]; float[] recall = new float[ stats.size() ]; for(int i = 0; i < precision.length; i++) { precision[i] = (float) stats.get(i).precision; recall[i] = (float) stats.get(i).recall; } Plot pl = new Plot("Precision-Recall curve", "Recall [tp / (tp + fn)]", "Precision [tp / (tp+fp)]", recall, precision); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.GREEN); return pl; }
/** * Plot the precision-recall curve * @param stats classification statistics */ public static void plotPrecisionRecall( ArrayList< ClassificationStatistics > stats) { // Extract precision and recall values float[] precision = new float[ stats.size() ]; float[] recall = new float[ stats.size() ]; for(int i = 0; i < precision.length; i++) { precision[i] = (float) stats.get(i).precision; recall[i] = (float) stats.get(i).recall; } Plot pl = new Plot("Precision-Recall curve", "Recall [tp / (tp + fn)]", "Precision [tp / (tp+fp)]", recall, precision); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.GREEN); pl.show(); }
/** * Plot the Receiver operating characteristic curve * @param stats classification statistics */ public static void plotROC( ArrayList< ClassificationStatistics > stats) { // Extract true positive and true negative rates float[] tpr = new float[ stats.size() ]; float[] fpr = new float[ stats.size() ]; for(int i = 0; i < tpr.length; i++) { tpr[i] = (float) stats.get(i).recall; fpr[i] = (float) (1f - stats.get(i).specificity); } Plot pl = new Plot("Receiver Operating Characteristic curve", "False Positive Rate (1 - specificity)", "True Positive Rate or sensitivity", fpr, tpr ); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.RED); pl.show(); }
/** * Plot the Receiver operating characteristic curve * @param stats classification statistics */ public static void plotROC( ArrayList< ClassificationStatistics > stats) { // Extract true positive and true negative rates float[] tpr = new float[ stats.size() ]; float[] fpr = new float[ stats.size() ]; for(int i = 0; i < tpr.length; i++) { tpr[i] = (float) stats.get(i).recall; fpr[i] = (float) (1f - stats.get(i).specificity); } Plot pl = new Plot("Receiver Operating Characteristic curve", "False Positive Rate (1 - specificity)", "True Positive Rate or sensitivity", fpr, tpr ); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.RED); pl.show(); }
/** * Plot the precision-recall curve * @param stats classification statistics */ public static void plotPrecisionRecall( ArrayList< ClassificationStatistics > stats) { // Extract precision and recall values float[] precision = new float[ stats.size() ]; float[] recall = new float[ stats.size() ]; for(int i = 0; i < precision.length; i++) { precision[i] = (float) stats.get(i).precision; recall[i] = (float) stats.get(i).recall; } Plot pl = new Plot("Precision-Recall curve", "Recall [tp / (tp + fn)]", "Precision [tp / (tp+fp)]", recall, precision); pl.setLimits(0, 1, 0, 1); pl.setSize(540, 512); pl.setColor(Color.GREEN); pl.show(); }
plot.setSize(1024, 768); plot.setLimits(-2*zRange, +2*zRange, 0, stageStep); double[] xVals = new double[(int)(2*zRange/stageStep) * 2 + 1];
plot.setSize(1024, 768); plot.setLimits(-2*zRange, +2*zRange, 0, stageStep); double[] xVals = new double[(int)(2*zRange/stageStep) * 2 + 1];
setSize(plot.pp.width, plot.pp.height); this.templateFlags = templateFlags;
setSize(plot.pp.width, plot.pp.height); this.templateFlags = templateFlags;
/** Resizes the canvas when the user resizes the window. To avoid a race condition while creating * a new window, this is ignored if no window exists or the window has not been activated yet. */ void resizeCanvas(int width, int height) { if (plot == null || plot.isFrozen()) { super.resizeCanvas(width, height); return; } resetMagnification(); if (width == oldWidth && height == oldHeight) return; if (plot == null) return; ImageWindow win = imp.getWindow(); if (win==null || !(win instanceof PlotWindow)) return; if (!win.isVisible()) return; if (!((PlotWindow)win).wasActivated) return; // window layout not finished yet? Dimension minSize = plot.getMinimumSize(); int plotWidth = width < minSize.width ? minSize.width : width; int plotHeight = height < minSize.height ? minSize.height : height; plot.setSize(plotWidth, plotHeight); setSize(width, height); oldWidth = width; oldHeight = height; }
/** Resizes the canvas when the user resizes the window. To avoid a race condition while creating * a new window, this is ignored if no window exists or the window has not been activated yet. */ void resizeCanvas(int width, int height) { if (plot == null || plot.isFrozen()) { super.resizeCanvas(width, height); return; } resetMagnification(); if (width == oldWidth && height == oldHeight) return; if (plot == null) return; ImageWindow win = imp.getWindow(); if (win==null || !(win instanceof PlotWindow)) return; if (!win.isVisible()) return; if (!((PlotWindow)win).wasActivated) return; // window layout not finished yet? Dimension minSize = plot.getMinimumSize(); int plotWidth = width < minSize.width ? minSize.width : width; int plotHeight = height < minSize.height ? minSize.height : height; plot.setSize(plotWidth, plotHeight); setSize(width, height); oldWidth = width; oldHeight = height; }
static public Plot makePlot(final CATAParameters cp, final String name, final VectorString3D c) { final double[] stdDev = c.getStdDevAtEachPoint(); if (null == stdDev) return null; final double[] index = new double[stdDev.length]; for (int i=0; i<index.length; i++) index[i] = i; Utils.log2("name is " + name); Utils.log2("c is " + c); Utils.log2("cp is " + cp); Utils.log2("stdDev is " + stdDev); Utils.log2("c.getCalibrationCopy() is " + c.getCalibrationCopy()); Utils.log2("c.getDelta() is " + c.getDelta()); final Calibration cal = c.getCalibrationCopy(); if (null == cal) Utils.log2("WARNING null calibration!"); final Plot plot = new Plot(name, name + " -- Point index (delta: " + Utils.cutNumber(c.getDelta(), 2) + " " + (null == cal ? "pixels" : cal.getUnits()) + ")", "Std Dev", index, stdDev); plot.setLimits(0, cp.plot_max_x, 0, cp.plot_max_y); plot.setSize(cp.plot_width, cp.plot_height); plot.setLineWidth(2); return plot; }