List of usage examples for org.jfree.data.xy DefaultXYDataset DefaultXYDataset
public DefaultXYDataset()
DefaultXYDataset
instance, initially containing no data. From source file:uk.ac.leeds.ccg.andyt.projects.moses.process.RegressionReport.java
/** * * @param variablesNames_StringArray//from w w w . j a va2 s .com * @param aggregatedSARData * @param comparisonCASData * @return * @throws IOException */ public static Object[] getRegressionParametersAndCreateXYLineCharts(String[] variablesNames_StringArray, double[][] aggregatedSARData, double[][] comparisonCASData) throws IOException { Object[] result = new Object[3]; Object[] t_RegressionParameters = new Object[comparisonCASData.length]; JFreeChart[] t_regressionXYLineCharts = new JFreeChart[comparisonCASData.length]; JFreeChart[] t_yequalsxXYLineCharts = new JFreeChart[comparisonCASData.length]; result[0] = t_RegressionParameters; result[1] = t_regressionXYLineCharts; result[2] = t_yequalsxXYLineCharts; String title = null; // String xAxisLabel; // String yAxisLabel; // xAxisLabel = new String("CAS Estimation (Observed)"); // yAxisLabel = new String("SAR Prediction (Expected)"); boolean legend = false; boolean tooltips = false; boolean urls = false; double[][] data; double[] a_RegressionParameters; for (int i = 0; i < comparisonCASData.length; i++) { title = variablesNames_StringArray[i + 1]; double[][] bounds = new double[2][2]; double[][] regressionLineChartData = new double[2][2]; double[][] yequalsxLineChartData = new double[2][2]; bounds[0][0] = Double.MAX_VALUE;// xmin SAR; bounds[0][1] = Double.MIN_VALUE;// xmax SAR; bounds[1][0] = Double.MAX_VALUE;// ymin CAS; bounds[1][1] = Double.MIN_VALUE;// ymax CAS; data = new double[2][comparisonCASData[i].length]; for (int j = 0; j < comparisonCASData[i].length; j++) { // data[0][j] = comparisonCASData[i][j]; // data[1][j] = aggregatedSARData[i][j]; data[0][j] = aggregatedSARData[i][j]; data[1][j] = comparisonCASData[i][j]; bounds[0][0] = Math.min(bounds[0][0], comparisonCASData[i][j]); bounds[0][1] = Math.max(bounds[0][1], comparisonCASData[i][j]); bounds[1][0] = Math.min(bounds[1][0], aggregatedSARData[i][j]); bounds[1][1] = Math.max(bounds[1][1], aggregatedSARData[i][j]); } System.out.println("xmin SAR " + bounds[0][0]); System.out.println("xmax SAR " + bounds[0][1]); System.out.println("ymin CAS " + bounds[1][0]); System.out.println("ymax CAS " + bounds[1][1]); // intercept, slope, RSquare double[] aSimpleRegressionParameters = printSimpleRegression(data); // // intercept, slope, RSquare? // double[] aSimpleOLSParameters = printOLSRegression(data); double[] usedRegressionParameters = aSimpleRegressionParameters; // // Force origin to be (0,0) // yequalsxLineChartData[0][0] = 0.0d; // yequalsxLineChartData[1][0] = 0.0d; // Get intercept on x or y axis if (bounds[0][0] > bounds[1][0]) { yequalsxLineChartData[0][0] = bounds[0][0]; yequalsxLineChartData[1][0] = bounds[0][0]; if (usedRegressionParameters[0] < bounds[0][0]) { regressionLineChartData[0][0] = (bounds[0][0] * usedRegressionParameters[1]) + usedRegressionParameters[0]; regressionLineChartData[1][0] = 0.0d; } else { regressionLineChartData[0][0] = 0.0d; regressionLineChartData[1][0] = usedRegressionParameters[0]; } } else { yequalsxLineChartData[0][0] = bounds[1][0]; yequalsxLineChartData[1][0] = bounds[1][0]; if (usedRegressionParameters[0] < bounds[1][0]) { // regressionLineChartData[0][0] = // (bounds[1][0] * usedRegressionParameters[1]) // + usedRegressionParameters[0]; regressionLineChartData[0][0] = (bounds[1][0] - usedRegressionParameters[0]) / usedRegressionParameters[1]; regressionLineChartData[1][0] = 0.0d; } else { regressionLineChartData[0][0] = 0.0d; regressionLineChartData[1][0] = usedRegressionParameters[0]; } } // Get intercept on edge of graph if (bounds[0][1] > bounds[1][1]) { yequalsxLineChartData[0][1] = bounds[1][1]; yequalsxLineChartData[1][1] = bounds[1][1]; // regressionLineChartData[0][1] = // (yequalsxLineChartData[1][1] - usedRegressionParameters[0]) // / usedRegressionParameters[1]; regressionLineChartData[1][1] = (yequalsxLineChartData[1][1] * usedRegressionParameters[1]) + usedRegressionParameters[1]; // regressionLineChartData[1][1] = // (yequalsxLineChartData[0][1] - usedRegressionParameters[0]) // / usedRegressionParameters[1]; regressionLineChartData[0][1] = yequalsxLineChartData[1][1]; if (regressionLineChartData[1][1] > bounds[1][1] && regressionLineChartData[1][1] > bounds[0][1]) { regressionLineChartData[1][1] = yequalsxLineChartData[0][1]; regressionLineChartData[0][1] = (regressionLineChartData[1][1] - usedRegressionParameters[0]) / usedRegressionParameters[1]; } } else { yequalsxLineChartData[0][1] = bounds[0][1]; yequalsxLineChartData[1][1] = bounds[0][1]; regressionLineChartData[0][1] = (yequalsxLineChartData[0][1] - usedRegressionParameters[0]) / usedRegressionParameters[1]; regressionLineChartData[1][1] = yequalsxLineChartData[0][1]; if (regressionLineChartData[0][1] > bounds[0][1]) { regressionLineChartData[1][1] = yequalsxLineChartData[0][1]; // regressionLineChartData[0][1] = // (regressionLineChartData[1][1] * usedRegressionParameters[1]) // + usedRegressionParameters[1]; regressionLineChartData[0][1] = (regressionLineChartData[1][1] - usedRegressionParameters[0]) / usedRegressionParameters[1]; } } System.out.println("Regression line"); t_RegressionParameters[i] = usedRegressionParameters; System.out.println( "(minx,miny) (" + regressionLineChartData[0][0] + "," + regressionLineChartData[1][0] + ")"); System.out.println( "(maxx,maxy) (" + regressionLineChartData[0][1] + "," + regressionLineChartData[1][1] + ")"); DefaultXYDataset regressionLineDefaultXYDataset = new DefaultXYDataset(); regressionLineDefaultXYDataset.addSeries("Regression Line", regressionLineChartData); t_regressionXYLineCharts[i] = ChartFactory.createXYLineChart(title, "", //xAxisLabel, "", //yAxisLabel, regressionLineDefaultXYDataset, //PlotOrientation.HORIZONTAL, PlotOrientation.VERTICAL, legend, tooltips, urls); System.out.println("Y = X line"); System.out.println( "(minx,miny) (" + yequalsxLineChartData[0][0] + "," + yequalsxLineChartData[1][0] + ")"); System.out.println( "(maxx,maxy) (" + yequalsxLineChartData[0][1] + "," + yequalsxLineChartData[1][1] + ")"); DefaultXYDataset yequalsxLineDefaultXYDataset = new DefaultXYDataset(); yequalsxLineDefaultXYDataset.addSeries("y = x", yequalsxLineChartData); t_yequalsxXYLineCharts[i] = ChartFactory.createXYLineChart(title, "", //xAxisLabel, "", //yAxisLabel, yequalsxLineDefaultXYDataset, PlotOrientation.VERTICAL, //PlotOrientation.HORIZONTAL, legend, tooltips, urls); } return result; }
From source file:de.bund.bfr.knime.pmmlite.views.chart.ChartCreator.java
private XYDataset createFunctionDataSet(Plotable plotable, String id, double minX, double maxX) throws ParseException, UnitException { double[][] points = plotable.getFunctionPoints(varX, varY, minX, maxX); if (points == null) { return null; }//from w w w . ja v a 2 s . c o m double[][] functionErrors = null; if (showConfidence || showPrediction) { functionErrors = plotable.getFunctionErrors(varX, varY, minX, maxX, showPrediction); } if (functionErrors != null) { YIntervalSeriesCollection functionDataset = new YIntervalSeriesCollection(); YIntervalSeries series = new YIntervalSeries(legend.get(id)); for (int j = 0; j < points[0].length; j++) { double error = Double.isNaN(functionErrors[1][j]) ? 0.0 : functionErrors[1][j]; series.add(points[0][j], points[1][j], points[1][j] - error, points[1][j] + error); } functionDataset.addSeries(series); return functionDataset; } else { DefaultXYDataset dataSet = new DefaultXYDataset(); dataSet.addSeries(legend.get(id), points); return dataSet; } }
From source file:uk.ac.leeds.ccg.andyt.projects.moses.process.RegressionReport.java
public static JFreeChart[] createScatterPlots(String[] a_Variables, double[][] a_SARExpectedData, double[][] a_CASObservedData, String xAxisLabel, String yAxisLabel) throws IOException { JFreeChart[] result;/* w w w .j a v a 2s.co m*/ String title = null; boolean legend = false; boolean tooltips = false; boolean urls = false; result = new JFreeChart[a_CASObservedData.length]; double[][] data; double[] a_RegressionParameters; // double[][] data = new double[ _CASObservedData.length ][ 2 ]; for (int i = 0; i < a_CASObservedData.length; i++) { title = a_Variables[i + 1]; data = new double[2][a_CASObservedData[i].length]; for (int j = 0; j < a_CASObservedData[i].length; j++) { data[0][j] = a_SARExpectedData[i][j]; data[1][j] = a_CASObservedData[i][j]; } DefaultXYDataset pointsDefaultXYDataset = new DefaultXYDataset(); // pointsDefaultXYDataset.addSeries( "t_ScatterPlot" + i, data ); pointsDefaultXYDataset.addSeries(a_Variables[i + 1], data); result[i] = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, pointsDefaultXYDataset, //PlotOrientation.HORIZONTAL, PlotOrientation.VERTICAL, legend, tooltips, urls); } return result; }
From source file:de.bund.bfr.knime.pmm.common.chart.ChartCreator.java
private void plotDataSet(XYPlot plot, Plotable plotable, String id, Color defaultColor, Shape defaultShape) throws ConvertException { double[][] points = plotable.getPoints(paramX, paramY, unitX, unitY, transformX, transformY); String legend = shortLegend.get(id); Color color = colors.get(id); Shape shape = shapes.get(id); if (addInfoInLegend) { legend = longLegend.get(id);/*from w w w .j a v a 2s. co m*/ } if (color == null) { color = defaultColor; } if (shape == null) { shape = defaultShape; } if (points != null) { DefaultXYDataset dataset = new DefaultXYDataset(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(drawLines, true); dataset.addSeries(legend, points); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer.setSeriesPaint(0, color); renderer.setSeriesShape(0, shape); int i; if (plot.getDataset(0) == null) { i = 0; } else { i = plot.getDatasetCount(); } plot.setDataset(i, dataset); plot.setRenderer(i, renderer); } }
From source file:org.yardstickframework.report.jfreechart.JFreeChartGraphPlotter.java
/** * @param folderToWrite Folder to write the resulted charts. * @param plots Collections of plots./*from w w w . j a va2s . c o m*/ * @param infoMap Map with additional plot info. * @param mode Generation mode. * @throws Exception If failed. */ private static void processPlots(File folderToWrite, Collection<List<PlotData>> plots, Map<String, List<JFreeChartPlotInfo>> infoMap, JFreeChartGenerationMode mode) throws Exception { ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); int idx = -1; while (true) { idx++; DefaultXYDataset dataSet = new DefaultXYDataset(); List<JFreeChartPlotInfo> infoList = new ArrayList<>(); String xAxisLabel = ""; String yAxisLabel = ""; String plotName = ""; int cnt = 0; for (List<PlotData> plotData0 : plots) { if (plotData0.size() <= idx) continue; PlotData plotData = plotData0.get(idx); dataSet.addSeries(plotData.plotName() + "_" + cnt++, plotData.series().data); xAxisLabel = plotData.xAxisLabel; yAxisLabel = plotData.yAxisLabel; plotName = plotData.plotName(); infoList.add(info(plotData.series(), mode)); } if (infoList.isEmpty()) break; JFreeChart chart = ChartFactory.createXYLineChart("", xAxisLabel, yAxisLabel, dataSet, PlotOrientation.VERTICAL, false, false, false); AxisSpace as = new AxisSpace(); as.add(150, RectangleEdge.LEFT); XYPlot plot = (XYPlot) chart.getPlot(); BasicStroke stroke = new BasicStroke(1); plot.setRenderer(renderer); plot.setBackgroundPaint(WHITE); plot.setRangeGridlinePaint(GRAY); plot.setDomainGridlinePaint(GRAY); plot.setFixedRangeAxisSpace(as); plot.setOutlineStroke(stroke); for (int i = 0; i < infoList.size(); i++) { Color color = PLOT_COLORS[i % PLOT_COLORS.length]; renderer.setSeriesPaint(i, color); renderer.setSeriesStroke(i, new BasicStroke(3)); // Line thickness. infoList.get(i).color(Integer.toHexString(color.getRGB()).substring(2)); } ValueAxis axis = plot.getRangeAxis(); Font font = new Font("Helvetica,Arial,sans-serif", Font.BOLD, axis.getTickLabelFont().getSize() + 5); axis.setTickLabelFont(font); axis.setLabelFont(font); plot.getDomainAxis().setTickLabelFont(font); plot.getDomainAxis().setLabelFont(font); chart.setTitle(new TextTitle(yAxisLabel, new Font(font.getName(), font.getStyle(), 30))); File res = new File(folderToWrite, plotName + ".png"); ChartUtilities.saveChartAsPNG(res, chart, 1000, 500, info); infoMap.put(res.getAbsolutePath(), infoList); println("Chart is saved to file: ", res); } }
From source file:de.bund.bfr.knime.pmmlite.views.chart.ChartCreator.java
private XYDataset createSampleDataSet(Plotable plotable, String id, double minX, double maxX) throws ParseException, UnitException { double[][] samplePoints = plotable.getFunctionSamplePoints(varX, varY, minX, maxX); if (samplePoints != null) { DefaultXYDataset sampleDataset = new DefaultXYDataset(); sampleDataset.addSeries(legend.get(id), samplePoints); return sampleDataset; }//from www . j a va 2s . c o m return null; }
From source file:de.bund.bfr.knime.pmmlite.views.chart.ChartCreator.java
private List<XYDataset> createStrictDataSets(Plotable plotable, String id) throws UnitException { List<XYDataset> dataSets = new ArrayList<>(); for (Map<String, Integer> choiceMap : plotable.getAllChoices(varX.getName())) { double[][] dataPoints = plotable.getPoints(varX, varY, choiceMap); if (dataPoints == null) { dataSets.add(null);/*ww w .java 2 s . co m*/ continue; } DefaultXYDataset dataSet = new DefaultXYDataset(); StringBuilder addLegend = new StringBuilder(); for (Map.Entry<String, Integer> entry : choiceMap.entrySet()) { if (!entry.getKey().equals(varX.getName())) { Double value = plotable.getVariables().get(entry.getKey()).get(entry.getValue()); if (value != null) { String s = NumberFormat.getInstance(Locale.US).format(value); addLegend.append(" (" + entry.getKey() + "=" + s + ")"); } } } dataSet.addSeries(legend.get(id) + addLegend, dataPoints); dataSets.add(dataSet); } return dataSets; }
From source file:OAT.trading.thread.BacktestThread.java
private void showEquityChart(String title, double[][] data) { if (data == null || data.length == 0) { return;//w w w . j a v a 2 s. co m } DefaultXYDataset dataset = new DefaultXYDataset(); dataset.addSeries("", data); JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dataset, false, false, false); new BasicChartFrame(title, chart).setVisible(true); }
From source file:de.bund.bfr.knime.pmm.common.chart.ChartCreator.java
private void plotDataSetStrict(XYPlot plot, Plotable plotable, String id) throws ConvertException { String legend = shortLegend.get(id); List<Color> colorList = colorLists.get(id); List<Shape> shapeList = shapeLists.get(id); ColorAndShapeCreator creator = new ColorAndShapeCreator(plotable.getNumberOfCombinations()); int index = 0; if (addInfoInLegend) { legend = longLegend.get(id);/*ww w . ja va2s .c om*/ } if (colorList == null || colorList.isEmpty()) { colorList = creator.getColorList(); } if (shapeList == null || shapeList.isEmpty()) { shapeList = creator.getShapeList(); } for (Map<String, Integer> choiceMap : plotable.getAllChoices()) { double[][] dataPoints = plotable.getPoints(paramX, paramY, unitX, unitY, transformX, transformY, choiceMap); if (dataPoints != null) { DefaultXYDataset dataSet = new DefaultXYDataset(); XYLineAndShapeRenderer dataRenderer = new XYLineAndShapeRenderer(drawLines, true); String addLegend = ""; for (String arg : choiceMap.keySet()) { if (!arg.equals(paramX)) { addLegend += " (" + arg + "=" + plotable.getFunctionArguments().get(arg).get(choiceMap.get(arg)) + ")"; } } dataSet.addSeries(legend + addLegend, dataPoints); dataRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); dataRenderer.setSeriesPaint(0, colorList.get(index)); dataRenderer.setSeriesShape(0, shapeList.get(index)); int i; if (plot.getDataset(0) == null) { i = 0; } else { i = plot.getDatasetCount(); } plot.setDataset(i, dataSet); plot.setRenderer(i, dataRenderer); } index++; } }
From source file:org.ala.spatial.web.services.GDMWSController.java
public static void generateCharts123(String outputdir) { try {/*from w w w .ja v a 2 s . c o m*/ IniReader ir = new IniReader(outputdir + "/gdm_params.txt"); double intercept = ir.getDoubleValue("GDMODEL", "Intercept"); // 1. read the ObservedVsPredicted.csv file System.out.println("Loading csv data"); CSVReader csv = new CSVReader(new FileReader(outputdir + "ObservedVsPredicted.csv")); List<String[]> rawdata = csv.readAll(); double[][] dataCht1 = new double[2][rawdata.size() - 1]; double[][] dataCht2 = new double[2][rawdata.size() - 1]; // for Chart 1: obs count int[] obscount = new int[11]; for (int i = 0; i < obscount.length; i++) { obscount[i] = 0; } System.out.println("populating data"); for (int i = 1; i < rawdata.size(); i++) { String[] row = rawdata.get(i); double obs = Double.parseDouble(row[4]); dataCht1[0][i - 1] = Double.parseDouble(row[6]); dataCht1[1][i - 1] = obs; dataCht2[0][i - 1] = Double.parseDouble(row[5]) - intercept; dataCht2[1][i - 1] = obs; int obc = (int) Math.round(obs * 10); obscount[obc]++; } DefaultXYDataset dataset1 = new DefaultXYDataset(); dataset1.addSeries("", dataCht1); DefaultXYDataset dataset2 = new DefaultXYDataset(); dataset2.addSeries("", dataCht2); DefaultCategoryDataset dataset3 = new DefaultCategoryDataset(); for (int i = 0; i < obscount.length; i++) { String col = "0." + i + "-0." + (i + 1); if (i == 10) { col = "0.9-1.0"; } dataset3.addValue(obscount[i] + 100, "col", col); } generateChartByType("Response Histogram", "Observed Dissimilarity Class", "Number of Site Pairs", dataset3, outputdir, "bar", "resphist"); XYDotRenderer renderer = new XYDotRenderer(); //Shape cross = ShapeUtilities.createDiagonalCross(3, 1); //renderer.setSeriesShape(0, cross); renderer.setDotWidth(3); renderer.setDotHeight(3); renderer.setSeriesPaint(0, Color.BLACK); JFreeChart jChart1 = ChartFactory.createScatterPlot( "Observed versus predicted compositional dissimilarity", "Predicted Compositional Dissimilarity", "Observed Compositional Dissimilarity", dataset1, PlotOrientation.VERTICAL, false, false, false); jChart1.getTitle().setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); XYPlot plot = (XYPlot) jChart1.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRenderer(0, renderer); NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setAutoRangeIncludesZero(false); domain.setAxisLineVisible(false); domain.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setAutoRangeIncludesZero(false); range.setAxisLineVisible(false); range.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); double dMinPred = domain.getRange().getLowerBound(); double dMaxPred = domain.getRange().getUpperBound(); double dMinObs = range.getRange().getLowerBound(); double dMaxObs = range.getRange().getUpperBound(); System.out.println("1..pred.min.max: " + dMinPred + ", " + dMaxPred); int regressionLineSegs = 10; double dInc = (dMaxPred - dMinPred) / regressionLineSegs; double[][] dataReg1 = new double[2][regressionLineSegs + 1]; DefaultXYDataset dsReg1 = new DefaultXYDataset(); int i = 0; for (double d = dMinPred; d <= dMaxPred; d += dInc, i++) { dataReg1[0][i] = d; dataReg1[1][i] = d; } dsReg1.addSeries("", dataReg1); XYSplineRenderer regressionRenderer = new XYSplineRenderer(); regressionRenderer.setBaseSeriesVisibleInLegend(true); regressionRenderer.setSeriesPaint(0, Color.RED); regressionRenderer.setSeriesStroke(0, new BasicStroke(1.5f)); regressionRenderer.setBaseShapesVisible(false); plot.setDataset(1, dsReg1); plot.setRenderer(1, regressionRenderer); System.out.println("Writing image...."); ChartUtilities.saveChartAsPNG(new File(outputdir + "plots/obspredissim.png"), jChart1, 600, 400); // For chart 3 JFreeChart jChart2 = ChartFactory.createScatterPlot( "Observed compositional dissimilarity vs predicted ecological distance", "Predicted ecological distance", "Observed Compositional Dissimilarity", dataset2, PlotOrientation.VERTICAL, false, false, false); jChart2.getTitle().setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); plot = (XYPlot) jChart2.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRenderer(0, renderer); domain = (NumberAxis) plot.getDomainAxis(); domain.setAutoRangeIncludesZero(false); domain.setAxisLineVisible(false); domain.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); range = (NumberAxis) plot.getRangeAxis(); range.setAutoRangeIncludesZero(false); range.setAxisLineVisible(false); range.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); dMinPred = domain.getRange().getLowerBound(); dMaxPred = domain.getRange().getUpperBound(); dMinObs = range.getRange().getLowerBound(); dMaxObs = range.getRange().getUpperBound(); System.out.println("2.pred.min.max: " + dMinPred + ", " + dMaxPred); regressionLineSegs = 10; dInc = (dMaxPred - dMinPred) / regressionLineSegs; dataReg1 = new double[2][regressionLineSegs + 1]; dsReg1 = new DefaultXYDataset(); i = 0; for (double d = dMinPred; d <= dMaxPred; d += dInc, i++) { dataReg1[0][i] = d; dataReg1[1][i] = (1.0 - Math.exp(-d)); } dsReg1.addSeries("", dataReg1); regressionRenderer.setBaseSeriesVisibleInLegend(true); regressionRenderer.setSeriesPaint(0, Color.RED); regressionRenderer.setSeriesStroke(0, new BasicStroke(1.5f)); regressionRenderer.setBaseShapesVisible(false); plot.setDataset(1, dsReg1); plot.setRenderer(1, regressionRenderer); System.out.println("Writing image...."); ChartUtilities.saveChartAsPNG(new File(outputdir + "plots/dissimdist.png"), jChart2, 600, 400); } catch (Exception e) { System.out.println("Unable to generate charts 2 and 3:"); e.printStackTrace(System.out); } }