/** Changes the drawing color. The frame and labels are * always drawn in black. * Must be called before the plot is displayed. * Note that there are more options available by using the methods of the Plot class instead. * @deprecated use the corresponding method of the Plot class */ public void setColor(Color c) { plot.setColor(c); }
/** Changes the drawing color. The frame and labels are * always drawn in black. * Must be called before the plot is displayed. * Note that there are more options available by using the methods of the Plot class instead. * @deprecated use the corresponding method of the Plot class */ public void setColor(Color c) { plot.setColor(c); }
public void setColor(String color) { setColor(Colors.decode(color, Color.black)); }
public void setColor(String color) { setColor(Colors.decode(color, Color.black)); }
/** Sets the drawing colors for the next objects that will be added to the plot. */ public void setColor(String c1, String c2) { setColor(Colors.decode(c1, Color.black), Colors.decode(c2, null)); }
/** Sets the drawing colors for the next objects that will be added to the plot. */ public void setColor(String c1, String c2) { setColor(Colors.decode(c1, Color.black), Colors.decode(c2, null)); }
/** * 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 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(); }
double setPlotColor(Plot plot) { interp.getLeftParen(); Color color = getColor(); Color color2 = null; if (interp.nextToken()!=')') { interp.getComma(); color2 = getColor(); } plot.setColor(color, color2); interp.getRightParen(); return Double.NaN; }
double addPlotLegend(Plot plot) { String labels = getFirstString(); String options = null; if (interp.nextToken()!=')') options = getLastString(); else interp.getRightParen(); plot.setColor(Color.BLACK); plot.setLineWidth(1); plot.addLegend(labels, options); return Double.NaN; }
double setPlotColor(Plot plot) { interp.getLeftParen(); Color color = getColor(); Color color2 = null; if (interp.nextToken()!=')') { interp.getComma(); color2 = getColor(); } plot.setColor(color, color2); interp.getRightParen(); return Double.NaN; }
double addPlotLegend(Plot plot) { String labels = getFirstString(); String options = null; if (interp.nextToken()!=')') options = getLastString(); else interp.getRightParen(); plot.setColor(Color.BLACK); plot.setLineWidth(1); plot.addLegend(labels, options); return Double.NaN; }
/** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); }
public Plot getPlot() { double[] x = PlotUtils.range(0, series.length - 1); Plot plot = new Plot("Profile", "x", "intensity", x, series); PlotUtils.setLimits(plot, x, series, getX(), getIntensities()); plot.draw(); plot.setColor(Color.BLUE); plot.addPoints(getX(), getIntensities(), Plot.CIRCLE); return plot; } }
/** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); }
/** For "Add from Table" and "Add from Arrays" adds item to the plot according to the current Choice settings * and sets the Style fields for it. */ private void addObjectFromTable() { float[][] data = getDataArrays(); if (data[1] == null) return; //no y data? then can't plot String label = columnChoice[1].getSelectedItem(); //take label from y int shape = Plot.toShape(symbolChoice.getSelectedItem()); float lineWidth = (float)(Tools.parseDouble(widthField.getText())); if (lineWidth > 0) plot.setLineWidth(lineWidth); plot.restorePlotObjects(); if (savedLimits != null) plot.setLimits(savedLimits); plot.setColor(colorField.getText(), color2Field.getText()); plot.addPoints(data[0], data[1], data[3], shape, label); if (data[2] != null) plot.addHorizontalErrorBars(data[2]); if (creatingPlot) { plot.setXYLabels(data[0]==null ? "x" : columnChoice[0].getSelectedItem(), columnChoice[1].getSelectedItem()); plot.setLimitsToFit(false); } else plot.fitRangeToLastPlotObject(); currentObjectIndex = plot.getNumPlotObjects()-1; setDialogStyleFields(currentObjectIndex); if (dialogType == ADD_FROM_TABLE) previousTableName = allTableNames[tableChoice.getSelectedIndex()]; }