/**
  * Set lower and upper limits for an ordinate
  *
  * @param i Axis index
  * @param lower Lower limit
  * @param upper Upper limit
  * @param tick Tick unit
  */
 public void setOrdinateRange(int i, double lower, double upper, double tick) {
   NumberAxis e = AxesList.get(i);
   e.setAutoRange(false);
   e.setLowerBound(lower);
   e.setUpperBound(upper);
   e.setTickUnit(new NumberTickUnit(tick));
 }
  private JFreeChart createErrorsChart(CategoryDataset dataset) {

    final JFreeChart chart =
        ChartFactory.createLineChart(
            Messages.ProjectAction_PercentageOfErrors(), // chart title
            null, // unused
            "%", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
            );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    final LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.RIGHT);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setUpperBound(100);
    rangeAxis.setLowerBound(0);

    final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(4.0f));
    ColorPalette.apply(renderer);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));

    return chart;
  }
  public void customise(JFreeChart chart, JRChart jasperchart) {

    // LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer();
    // renderer.setSeriesPaint(1, Color.green);
    // renderer.setSeriesPaint(4, Color.orange);

    // chart.setTitle("Customiser has set a new Title");

    try {

      XYPlot plot = chart.getXYPlot();

      NumberAxis x = (NumberAxis) plot.getDomainAxis();
      // x.setLowerBound(x.getLowerBound()+100);
      x.setUpperBound(x.getUpperBound() + 100);

      NumberAxis y = (NumberAxis) plot.getRangeAxis();
      y.setLowerBound(0);
      y.setUpperBound(100);

    } catch (NullPointerException npe) {
      System.err.println("Error setting chart axis ranges :: " + npe);
    }
  }
 /* (non-Javadoc)
  * @see com.feilong.tools.jfreechart.xy.FeiLongBaseXYChartEntity#setChildDefaultNumberAxisAttributes()
  */
 protected void setChildDefaultNumberAxisAttributes() {
   CategoryDataset categoryDataset = categoryPlot.getDataset();
   // 数据轴的数据标签 可以只显示整数标签,需要将AutoTickUnitSelection设false
   // numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   double fudong = 0.5;
   NumberAxis numberAxis = getNumberAxis();
   // 设置最大值
   numberAxis.setUpperBound(
       DatasetUtilities.findMaximumRangeValue(categoryDataset).doubleValue() + fudong);
   // 设置最小值
   numberAxis.setLowerBound(
       DatasetUtilities.findMinimumRangeValue(categoryDataset).doubleValue() - fudong);
   // 设置坐标轴的最小值,默认的是0.00000001
   // numberAxis.setAutoRangeMinimumSize(1);
   // 是否强制在自动选择的数据范围中包含0
   numberAxis.setAutoRangeIncludesZero(false);
   // 纵轴显示范围
   // numberAxis.setRange(85, 100.5);
 }
示例#5
0
 private JPanel createChartPanel(XYDataset dataset) {
   JPanel ret = new JPanel();
   BoxLayout retLayout = new BoxLayout(ret, javax.swing.BoxLayout.Y_AXIS);
   ret.setLayout(retLayout);
   JFreeChart chart =
       ChartFactory.createXYLineChart(
           null, // title
           "Period, s", // x-axis label
           "Coherence", // y-axis label
           dataset, // data
           PlotOrientation.VERTICAL, // orientation
           true, // create legend?
           true, // generate tooltips?
           false // generate URLs?
           );
   chart.setBackgroundPaint(Color.white);
   TextTitle title =
       new TextTitle(
           "Start time: "
               + TimeInterval.formatDate(
                   timeInterval.getStartTime(), TimeInterval.DateFormatType.DATE_FORMAT_NORMAL)
               + ", Duration: "
               + timeInterval.convert(),
           ret.getFont());
   chart.setTitle(title);
   plot = chart.getXYPlot();
   NumberAxis domainAxis = new LogarithmicAxis("Period, s");
   plot.setDomainAxis(domainAxis);
   NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
   rangeAxis.setLowerBound(0);
   rangeAxis.setUpperBound(1);
   rangeAxis.setAutoRangeIncludesZero(true);
   plot.setBackgroundPaint(Color.lightGray);
   plot.setDomainGridlinePaint(Color.white);
   plot.setRangeGridlinePaint(Color.white);
   plot.setDomainCrosshairVisible(true);
   plot.setRangeCrosshairVisible(true);
   chartPanel = new TraceViewChartPanel(chart, true);
   ret.add(chartPanel);
   ret.add(getOptionP());
   return ret;
 }
示例#6
0
  private ChartPanel getChartPanel(DefaultXYZDataset dataset, int i) {
    String key = (String) dataset.getSeriesKey(0);
    DateAxis yAxis = new DateAxis("Date");
    yAxis.setLowerMargin(0.0);
    yAxis.setUpperMargin(0.0);
    yAxis.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 1));

    NumberAxis xAxis = new NumberAxis("Hour");
    xAxis.setUpperMargin(0.0);
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(1000.0 * 60.0 * 60.0 * 24.0);
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);

    // range scaling
    PaintScale paintScale;
    if (colorSort.getValue().equals("gray")) // gray scaling
    {
      paintScale = new GrayPaintScale(0.0, maxArray[i]);
    } else {

      int color_max, color_min;
      if (colorSort.getValue().equals("red")) { // red scaling
        color_max = 0xFF33FF;
        color_min = 0xFF3300;
      } else if (colorSort.getValue().equals("blue")) { // blue scaling
        color_max = 0x0033FF;
        color_min = 0x003300;
      } else { // yellow scaling
        color_max = 0xFFFFFF;
        color_min = 0xFFFF00;
      }
      paintScale = new LookupPaintScale(0.0, maxArray[i], new Color(color_max));
      int d = Math.max((color_max - color_min) / ((int) maxArray[i] + 1), 1);
      for (int k = 0; k <= maxArray[i]; k++) {
        ((LookupPaintScale) paintScale)
            .add(new Double(k + 0.5), new Color(color_max - (k + 1) * d));
      }
    }
    renderer.setPaintScale(paintScale);

    XYPlot plot = new XYPlot(dataset, yAxis, xAxis, renderer);
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setForegroundAlpha(0.66F);
    JFreeChart chart = new JFreeChart(key, plot);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);

    // adding data ranges
    NumberAxis scaleAxis = new NumberAxis(null);
    scaleAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    scaleAxis.setLowerBound(0.0);
    scaleAxis.setUpperBound(maxArray[i]);
    PaintScaleLegend psl = new PaintScaleLegend(paintScale, scaleAxis);
    psl.setAxisOffset(5.0);
    psl.setPosition(RectangleEdge.BOTTOM);
    psl.setMargin(new RectangleInsets(5, 5, 5, 5));
    chart.addSubtitle(psl);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createLineBorder(Color.lightGray));
    return chartPanel;
  }
  static JFreeChart createChart(
      NavigableMap<TimeAxisKey, DiffStat> aggregatedDiffstats,
      DiffStatConfiguration configuration) {

    boolean legend = false;
    boolean tooltips = false;
    boolean urls = false;
    Font helvetica = new Font("Helvetica", Font.PLAIN, 11 * configuration.multiplierInt());

    XYDatasetMinMax datasetMinMax =
        createDeltaDataset("Additions and Delections", aggregatedDiffstats);
    XYDataset dataset = datasetMinMax.dataset;
    JFreeChart chart =
        ChartFactory.createTimeSeriesChart("", "", "", dataset, legend, tooltips, urls);

    chart.setBackgroundPaint(WHITE);
    chart.setBorderVisible(false);

    float strokeWidth = 1.2f * configuration.multiplierFloat();

    XYPlot plot = chart.getXYPlot();
    plot.setOrientation(VERTICAL);
    plot.setBackgroundPaint(WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(AXIS_LINE_COLOR);
    plot.setDomainGridlineStroke(new BasicStroke(1.0f * configuration.multiplierFloat()));
    plot.setRangeGridlinesVisible(false);

    plot.setOutlineVisible(false);

    DateAxis dateAxis = (DateAxis) plot.getDomainAxis();
    dateAxis.setDateFormatOverride(new SimpleDateFormat("MM/yy"));
    dateAxis.setTickLabelFont(helvetica);
    dateAxis.setAxisLineVisible(false);
    dateAxis.setTickUnit(computeDateTickUnit(aggregatedDiffstats));
    RectangleInsets insets =
        new RectangleInsets(
            8.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble());
    dateAxis.setTickLabelInsets(insets);

    NumberAxis additionDeletionAxis = (NumberAxis) plot.getRangeAxis(0);
    additionDeletionAxis.setAxisLineVisible(false);
    additionDeletionAxis.setLabel("Additions and Deletions");
    additionDeletionAxis.setLabelFont(helvetica);
    additionDeletionAxis.setTickLabelFont(helvetica);
    additionDeletionAxis.setRangeType(RangeType.FULL);
    int lowerBound = datasetMinMax.min + (int) (datasetMinMax.min * 0.1d);
    additionDeletionAxis.setLowerBound(lowerBound);
    int upperBound = datasetMinMax.max + (int) (datasetMinMax.max * 0.1d);
    additionDeletionAxis.setUpperBound(upperBound);
    additionDeletionAxis.setNumberFormatOverride(new AbbreviatingNumberFormat());
    additionDeletionAxis.setMinorTickMarksVisible(false);
    additionDeletionAxis.setTickMarkInsideLength(5.0f * configuration.multiplierFloat());
    additionDeletionAxis.setTickMarkOutsideLength(0.0f);
    additionDeletionAxis.setTickMarkStroke(new BasicStroke(2.0f * configuration.multiplierFloat()));
    additionDeletionAxis.setTickUnit(
        new NumberTickUnit(computeTickUnitSize(datasetMinMax.max + abs(datasetMinMax.min))));

    XYAreaRenderer areaRenderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    areaRenderer.setOutline(true);
    areaRenderer.setSeriesOutlinePaint(0, ADDED_STROKE);
    areaRenderer.setSeriesOutlineStroke(0, new BasicStroke(strokeWidth));
    areaRenderer.setSeriesPaint(0, ADDED_FILL);
    areaRenderer.setSeriesOutlinePaint(1, REMOVED_STROKE);
    areaRenderer.setSeriesOutlineStroke(1, new BasicStroke(strokeWidth));
    areaRenderer.setSeriesPaint(1, REMOVED_FILL);
    plot.setRenderer(0, areaRenderer);

    // Total Axis
    NumberAxis totalAxis = new NumberAxis("Total Lines");
    totalAxis.setAxisLineVisible(false);
    totalAxis.setLabelPaint(VALUE_LABEL);
    totalAxis.setTickLabelPaint(TOTAL_LABEL);
    totalAxis.setLabelFont(helvetica);
    totalAxis.setTickLabelFont(helvetica);
    totalAxis.setNumberFormatOverride(new AbbreviatingNumberFormat());
    totalAxis.setMinorTickMarksVisible(false);
    totalAxis.setTickMarkInsideLength(5.0f * configuration.multiplierFloat());
    totalAxis.setTickMarkOutsideLength(0.0f);
    totalAxis.setTickMarkStroke(new BasicStroke(2.0f * configuration.multiplierFloat()));
    totalAxis.setTickMarkPaint(TOTAL_LABEL);
    plot.setRangeAxis(1, totalAxis);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

    XYDatasetAndTotal datasetAndTotal = createTotalDataset("Total Lines", aggregatedDiffstats);
    XYDataset totalDataSet = datasetAndTotal.dataset;
    plot.setDataset(1, totalDataSet);
    plot.mapDatasetToRangeAxis(1, 1);
    //        XYItemRenderer totalRenderer = new XYSplineRenderer();
    XYItemRenderer totalRenderer = new StandardXYItemRenderer();
    totalRenderer.setSeriesPaint(0, TOTAL_FILL);
    totalRenderer.setSeriesStroke(
        0,
        new BasicStroke(
            strokeWidth,
            CAP_ROUND,
            JOIN_ROUND,
            10.0f * configuration.multiplierFloat(),
            new float[] {
              6.0f * configuration.multiplierFloat(), 3.0f * configuration.multiplierFloat()
            },
            0.0f));
    plot.setRenderer(1, totalRenderer);

    totalAxis.setTickUnit(new NumberTickUnit(computeTickUnitSize(datasetAndTotal.total)));

    return chart;
  }
示例#8
0
  /**
   * Plot the results produced by the testing methods in this class.
   *
   * @param results The results of one or more tests. They must all have the same type {@link TYPE}.
   *     If more than one result is to be plotted then only {@link TYPE#STDP} or {@link
   *     TYPE#STDP_1D} are supported, and it is assumed that they all have the same pre- and
   *     post-synaptic spike patterns.
   * @param singlePlot If plotting more than one TestResult then whether to show the results on a
   *     single plot (true) or separate plots (false).
   * @param timeResolution The time resolution which the simulation was run at.
   * @param logSpikesAndStateVariables Whether to include pre- and post-synaptic spikes and any
   *     state variables exposed by the synapse model in the plot. This is ignored if more than one
   *     result is to be plotted.
   * @param showInFrame Whether to display the result in a frame.
   */
  public static JFreeChart createChart(
      TestResults[] results,
      boolean singlePlot,
      int timeResolution,
      boolean logSpikesAndStateVariables,
      boolean showInFrame,
      String title) {
    JFreeChart resultsPlot = null;
    int resultsCount = results.length;

    // Make sure they're all the same type.
    for (int ri = 0; ri < results.length; ri++) {
      if (ri < resultsCount - 1
          && results[ri].getProperty("type") != results[ri + 1].getProperty("type")) {
        throw new IllegalArgumentException("All results must have the same type.");
      }
      if (resultsCount > 1
          && results[ri].getProperty("type") != TYPE.STDP
          && results[ri].getProperty("type") != TYPE.STDP_1D) {
        throw new IllegalArgumentException(
            "Multiple results can only be plotted for types STDP or STDP_1D.");
      }
    }

    TYPE type = (TYPE) results[0].getProperty("type");

    XYLineAndShapeRenderer xyRenderer;
    XYToolTipGenerator tooltipGen = new StandardXYToolTipGenerator();

    if (type == TYPE.STDP) {
      CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(new NumberAxis("t (s)"));

      if (singlePlot) { // Plot all result sets together.
        DefaultXYDataset efficacyData = new DefaultXYDataset();
        for (TestResults result : results) {
          String efficacyLabel =
              (resultsCount == 1) ? "Efficacy" : "" + result.getProperty("label");
          efficacyData.addSeries(efficacyLabel, result.getResult("Time", "Efficacy"));
        }
        xyRenderer = new XYLineAndShapeRenderer(true, false);
        xyRenderer.setBaseToolTipGenerator(tooltipGen);
        combinedPlot.add(new XYPlot(efficacyData, null, new NumberAxis("Efficacy"), xyRenderer), 4);
      } else { // Plot each result set separately.
        for (TestResults result : results) {
          DefaultXYDataset efficacyData = new DefaultXYDataset();
          String efficacyLabel =
              (resultsCount == 1) ? "Efficacy" : "" + result.getProperty("label");
          efficacyData.addSeries(efficacyLabel, result.getResult("Time", "Efficacy"));
          xyRenderer = new XYLineAndShapeRenderer(true, false);
          xyRenderer.setBaseToolTipGenerator(tooltipGen);
          combinedPlot.add(
              new XYPlot(efficacyData, null, new NumberAxis("Efficacy"), xyRenderer), 4);
        }
      }

      // Don't plot trace data for multiple tests.
      if (resultsCount == 1 && logSpikesAndStateVariables) {
        DefaultXYDataset traceData = new DefaultXYDataset();
        for (String label : results[0].getResultLabels()) {
          if (!label.startsWith("Time")
              && !label.startsWith("Efficacy")
              && !label.equals("Pre-synaptic spikes")
              && !label.equals("Post-synaptic spikes")) {
            traceData.addSeries(label, results[0].getResult("Time", label));
          }
        }
        xyRenderer = new XYLineAndShapeRenderer(true, false);
        xyRenderer.setBaseToolTipGenerator(tooltipGen);
        combinedPlot.add(new XYPlot(traceData, null, new NumberAxis("State"), xyRenderer), 3);

        DefaultXYDataset spikeData = new DefaultXYDataset();
        spikeData.addSeries(
            "Pre-synaptic spikes", results[0].getResult("Time", "Pre-synaptic spikes"));
        spikeData.addSeries(
            "Post-synaptic spikes", results[0].getResult("Time", "Post-synaptic spikes"));
        xyRenderer = new XYLineAndShapeRenderer(true, false);
        xyRenderer.setBaseToolTipGenerator(tooltipGen);
        combinedPlot.add(
            new XYPlot(spikeData, null, new NumberAxis("Pre/post potential"), xyRenderer), 3);
      }

      resultsPlot = new JFreeChart(title, null, combinedPlot, true);
      resultsPlot.setBackgroundPaint(Color.WHITE);
      resultsPlot.getPlot().setBackgroundPaint(Color.WHITE);
      ((XYPlot) resultsPlot.getPlot()).setRangeGridlinePaint(Color.LIGHT_GRAY);
      ((XYPlot) resultsPlot.getPlot()).setDomainGridlinePaint(Color.LIGHT_GRAY);

    } else if (type == TYPE.STDP_1D) {
      DecimalFormat timeFormatter = new DecimalFormat();
      timeFormatter.setMultiplier(1000);
      NumberAxis domainAxis = new NumberAxis("\u0394t (ms)");
      domainAxis.setNumberFormatOverride(timeFormatter);
      CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(domainAxis);

      if (singlePlot) { // Plot all result sets together.
        DefaultXYDataset efficacyData = new DefaultXYDataset();
        for (TestResults result : results) {
          String efficacyLabel =
              (resultsCount == 1) ? "Efficacy" : "" + result.getProperty("label");
          efficacyData.addSeries(efficacyLabel, result.getResult("Time delta", "Efficacy"));
        }
        xyRenderer = new XYLineAndShapeRenderer(true, false);
        xyRenderer.setBaseToolTipGenerator(tooltipGen);
        combinedPlot.add(new XYPlot(efficacyData, null, new NumberAxis("Efficacy"), xyRenderer), 4);
      } else { // Plot each result set separately.
        for (TestResults result : results) {
          DefaultXYDataset efficacyData = new DefaultXYDataset();
          String efficacyLabel =
              (resultsCount == 1) ? "Efficacy" : "" + result.getProperty("label");
          efficacyData.addSeries(efficacyLabel, result.getResult("Time delta", "Efficacy"));
          xyRenderer = new XYLineAndShapeRenderer(true, false);
          xyRenderer.setBaseToolTipGenerator(tooltipGen);
          combinedPlot.add(
              new XYPlot(efficacyData, null, new NumberAxis("Efficacy"), xyRenderer), 4);
        }
      }

      resultsPlot = new JFreeChart(title, null, combinedPlot, true);
      resultsPlot.setBackgroundPaint(Color.WHITE);
      resultsPlot.getPlot().setBackgroundPaint(Color.WHITE);
      ((XYPlot) resultsPlot.getPlot()).setRangeGridlinePaint(Color.LIGHT_GRAY);
      ((XYPlot) resultsPlot.getPlot()).setDomainGridlinePaint(Color.LIGHT_GRAY);
    } else if (type == TYPE.STDP_2D) {
      double[][] data = results[0].getResult("Time delta 1", "Time delta 2", "Efficacy");

      DefaultXYZDataset plotData = new DefaultXYZDataset();
      plotData.addSeries("Efficacy", data);

      // Set up paint scale, and convert domain axes from seconds to
      // milliseconds (XYBlockRenderer won't deal with fractional values
      // in the domain axes)
      double min = Double.MAX_VALUE, max = -min;
      double[] efficacy = data[2];
      for (int i = 0; i < data[0].length; i++) {
        if (efficacy[i] < min) min = efficacy[i];
        if (efficacy[i] > max) max = efficacy[i];

        data[0][i] = Math.round(data[0][i] * 1000);
        data[1][i] = Math.round(data[1][i] * 1000);
      }

      XYBlockRenderer renderer = new XYBlockRenderer();

      double range = Math.max(Math.abs(min), Math.abs(max));
      double rangeBase = 0;
      if (min < 0) min = -range;
      if (max > 0) max = range;
      // If the value range does not cross the zero point, don't use a zero-based range.
      if ((min > 0) || (max < 0)) {
        range = Math.abs(max - min);
        rangeBase = Math.min(Math.abs(min), Math.abs(max));
      }
      if (min >= max) {
        max = min + Double.MIN_VALUE * 10;
      }

      LookupPaintScale scale = new LookupPaintScale(min, max, Color.WHITE);
      if (min < 0) {
        for (int ci = 0; ci <= 255; ci++) {
          double v = -(ci / 255.0) * range - rangeBase;
          scale.add(v, new Color(0, ci, ci));
        }
      }
      if (max > 0) {
        for (int ci = 0; ci <= 255; ci++) {
          double v = (ci / 255.0) * range + rangeBase;
          scale.add(v, new Color(ci, ci, 0));
        }
      }
      renderer.setPaintScale(scale);
      renderer.setSeriesToolTipGenerator(0, new StandardXYZToolTipGenerator());
      int displayResolution =
          ((Integer) results[0].getProperty("display time resolution")).intValue();
      renderer.setBlockWidth(1000.0 / displayResolution);
      renderer.setBlockHeight(1000.0 / displayResolution);

      NumberAxis xAxis = new NumberAxis("\u0394t1 (ms)");
      NumberAxis yAxis = new NumberAxis("\u0394t2 (ms)");

      XYPlot plot = new XYPlot(plotData, xAxis, yAxis, renderer);
      plot.setDomainGridlinesVisible(false);

      resultsPlot = new JFreeChart(title, plot);
      resultsPlot.removeLegend();
      NumberAxis valueAxis = new NumberAxis();
      valueAxis.setLowerBound(scale.getLowerBound());
      valueAxis.setUpperBound(scale.getUpperBound());
      PaintScaleLegend legend = new PaintScaleLegend(scale, valueAxis);
      legend.setPosition(RectangleEdge.RIGHT);
      legend.setMargin(5, 5, 5, 5);
      resultsPlot.addSubtitle(legend);
    }

    if (showInFrame) {
      JFrame plotFrame = new JFrame(title);
      plotFrame.add(new ChartPanel(resultsPlot));
      plotFrame.setExtendedState(plotFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
      plotFrame.pack();
      plotFrame.setVisible(true);
    }

    return resultsPlot;
  }