Example usage for java.awt Color magenta

List of usage examples for java.awt Color magenta

Introduction

In this page you can find the example usage for java.awt Color magenta.

Prototype

Color magenta

To view the source code for java.awt Color magenta.

Click Source Link

Document

The color magenta.

Usage

From source file:org.adempiere.apps.graph.ChartBuilder.java

private void setupCategoryChart(JFreeChart chart) {
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.BLUE);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesPaint(3, Color.GREEN);
    renderer.setSeriesPaint(4, Color.ORANGE);
    renderer.setSeriesPaint(5, Color.CYAN);
    renderer.setSeriesPaint(6, Color.MAGENTA);
    renderer.setSeriesPaint(7, Color.GRAY);
    renderer.setSeriesPaint(8, Color.PINK);

    plot.setRenderer(renderer);/*from w  ww  .j  av a2  s .c  o  m*/
}

From source file:ngat.opsgui.xcomp.SeeingPanel2.java

private JPanel makeChartPanel() {

    tac = new TimeAxisChart("Seeing");
    tac.setTimeLabel("Time [UTC]");
    tac.setYLabel("Seeing [asec]");
    tac.setShowGridLines(true);/*from   ww w .  j a va  2 s.c o m*/
    tac.setTimeAxisRange(6 * 3600 * 1000L);
    tac.setYAxisStart(0.0);
    tac.setYAxisEnd(3.0);
    tac.setChartBackgroundColor(jPanel5.getBackground());

    tac.addRangeBackground(0.0, 0.8, new Color(192, 248, 193));
    tac.addRangeBackground(0.8, 1.3, new Color(248, 233, 192));
    tac.addRangeBackground(1.3, 2.0, new Color(248, 198, 192));
    tac.addRangeBackground(2.0, 3.0, new Color(192, 236, 248));

    try {
        tac.createPlot("RAW_STD", "Standards Raw", TimeAxisChart.SHAPE_TRIANGLE, 0, Color.magenta, false, true);
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        tac.createPlot("CORR_STD", "Standards Corrected", TimeAxisChart.SHAPE_RECTANGLE, 0, Color.orange, false,
                true);
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        tac.createPlot("RAW_SCI", "Science Raw", TimeAxisChart.SHAPE_TRIANGLE, 0, Color.blue, false, true);
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        tac.createPlot("CORR_SCI", "Science Corrected", TimeAxisChart.SHAPE_RECTANGLE, 0, Color.green, false,
                true);
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        tac.createPlot("PRED", "Prediction", TimeAxisChart.SHAPE_NONE, 0, Color.red, true, true);
    } catch (Exception e) {
        e.printStackTrace();
    }

    JPanel cp = tac.createChartPanel();

    cp.setLayout(new BorderLayout());
    cp.setPreferredSize(new Dimension(550, 320));

    return cp;

}

From source file:gdsc.smlm.ij.plugins.EMGainAnalysis.java

private void plotPMF() {
    if (!showPMFDialog())
        return;/*from   w w w .  j  a va 2 s.  c  o m*/

    final int gaussWidth = 5;
    int dummyBias = (int) Math.max(500, gaussWidth * _noise + 1);

    double[] pmf = pdf(0, _photons, _gain, _noise, dummyBias);
    double[] x = Utils.newArray(pmf.length, 0, 1.0);
    double yMax = Maths.max(pmf);

    // Truncate x
    int max = 0;
    double sum = 0;
    double p = 1 - tail;
    while (sum < p && max < pmf.length) {
        sum += pmf[max];
        max++;
    }

    int min = pmf.length;
    sum = 0;
    p = 1 - head;
    while (sum < p && min > 0) {
        min--;
        sum += pmf[min];
    }

    //int min = (int) (dummyBias - gaussWidth * _noise);
    pmf = Arrays.copyOfRange(pmf, min, max);
    x = Arrays.copyOfRange(x, min, max);

    // Get the approximation
    double[] f = new double[x.length];
    PoissonGammaGaussianFunction fun = new PoissonGammaGaussianFunction(1.0 / _gain, _noise);
    double expected = _photons;
    if (offset != 0)
        expected += offset * expected / 100.0;
    expected *= _gain;
    for (int i = 0; i < f.length; i++) {
        // Adjust the x-values to remove the dummy bias
        x[i] -= dummyBias;
        f[i] = fun.likelihood(x[i], expected);
    }
    if (showApproximation)
        yMax = Maths.maxDefault(yMax, f);

    String label = String.format("Gain=%s, noise=%s, photons=%s", Utils.rounded(_gain), Utils.rounded(_noise),
            Utils.rounded(_photons));

    Plot2 plot = new Plot2("PMF", "ADUs", "p");
    plot.setLimits(x[0], x[x.length - 1], 0, yMax);
    plot.setColor(Color.red);
    plot.addPoints(x, pmf, Plot2.LINE);
    if (showApproximation) {
        plot.setColor(Color.blue);
        plot.addPoints(x, f, Plot2.LINE);
    }

    plot.setColor(Color.magenta);
    plot.drawLine(_photons * _gain, 0, _photons * _gain, yMax);
    plot.setColor(Color.black);
    plot.addLabel(0, 0, label);
    PlotWindow win1 = Utils.display("PMF", plot);

    // Plot the difference between the actual and approximation
    double[] delta = new double[f.length];
    for (int i = 0; i < f.length; i++) {
        if (pmf[i] == 0 && f[i] == 0)
            continue;
        if (relativeDelta)
            delta[i] = DoubleEquality.relativeError(f[i], pmf[i]) * Math.signum(f[i] - pmf[i]);
        else
            delta[i] = f[i] - pmf[i];
    }

    Plot2 plot2 = new Plot2("PMF delta", "ADUs", (relativeDelta) ? "Relative delta" : "delta");
    double[] limits = Maths.limits(delta);
    plot2.setLimits(x[0], x[x.length - 1], limits[0], limits[1]);
    plot2.setColor(Color.red);
    plot2.addPoints(x, delta, Plot2.LINE);
    plot2.setColor(Color.magenta);
    plot2.drawLine(_photons * _gain, limits[0], _photons * _gain, limits[1]);
    plot2.setColor(Color.black);
    plot2.addLabel(0, 0, label + ((offset == 0) ? "" : ", expected = " + Utils.rounded(expected / _gain)));
    PlotWindow win2 = Utils.display("PMF delta", plot2);

    if (Utils.isNewWindow()) {
        Point p2 = win2.getLocation();
        p2.y += win1.getHeight();
        win2.setLocation(p2);
    }
}

From source file:org.mathIT.gui.GraphViewer.java

/**
 * Gets relevance clusters for this graph and marks them in the canvas. 
 *///from w  w w . ja v a2 s  . co m
private void displayRelevanceClusters() {
    ArrayList<OrderedSet<Integer>> list = invokerGraph.getRelevanceClusters().getClusters();

    // Change the vertex color palette to mark the most relevant vertices red:
    palette = new java.awt.Color[] { java.awt.Color.YELLOW, // category 0
            java.awt.Color.BLUE, // category 1
            java.awt.Color.GREEN, // category 2
            java.awt.Color.MAGENTA, // category 3 
            java.awt.Color.RED, // category 4
            java.awt.Color.ORANGE, java.awt.Color.CYAN, java.awt.Color.LIGHT_GRAY, java.awt.Color.PINK,
            java.awt.Color.BLACK };

    // add a listener for ToolTips
    canvas.setVertexToolTipTransformer(new ToStringLabeller<V>() {
        /* (non-Javadoc)
         * @see edu.uci.ics.jung.visualization.decorators.DefaultToolTipFunction#getToolTipText(java.lang.Object)
         */
        @Override
        @SuppressWarnings("unchecked")
        public String transform(V v) {
            if (v instanceof Graph) {
                return ((Graph<V>) v).getVertices().toString();
            }
            //return super.transform((V) v);
            return "Network relevance: "
                    + org.mathIT.util.Formats.O_DOT_A3.format(invokerGraph.getRelevance(v.getIndex()));
        }
    });
    // ---- Vertex color: ----
    canvas.getRenderer().setVertexRenderer(new VertexFillColor(list));
    canvas.repaint();
}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Displays a vertical bar chart in its own frame.
 *
 * @return a high low chart./*from   w w  w  .j a  v a  2 s  . co m*/
 */
public JFreeChart createHighLowChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("timeseries.highlow.title");
    final String domain = this.resources.getString("timeseries.highlow.domain");
    final String range = this.resources.getString("timeseries.highlow.range");
    final String subtitleStr = this.resources.getString("timeseries.highlow.subtitle");
    final DefaultHighLowDataset data = DemoDatasetFactory.createHighLowDataset();
    final JFreeChart chart = ChartFactory.createHighLowChart(title, domain, range, data, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.magenta));
    return chart;

}

From source file:gdsc.smlm.ij.plugins.pcpalm.PCPALMAnalysis.java

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);//from  w  w  w.  j a v a 2 s.c  om

    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;
}

From source file:com.voterData.graph.Graph.java

public static JFreeChart getRaceDistbn2012(Map<String, Double> dataMap) {
    DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
    for (String key : dataMap.keySet()) {
        if (key.equals("A_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "REP");
        } else if (key.equals("B_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "REP");
        } else if (key.equals("I_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "REP");
        } else if (key.equals("O_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "REP");
        } else if (key.equals("M_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "REP");
        } else if (key.equals("U_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "REP");
        } else if (key.equals("W_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "REP");
        } else if (key.equals("A_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "DEM");
        } else if (key.equals("B_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "DEM");
        } else if (key.equals("I_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "DEM");
        } else if (key.equals("O_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "DEM");
        } else if (key.equals("M_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "DEM");
        } else if (key.equals("U_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "DEM");
        } else if (key.equals("W_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "DEM");
        } else if (key.equals("A_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "UNA");
        } else if (key.equals("B_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "UNA");
        } else if (key.equals("I_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "UNA");
        } else if (key.equals("O_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "UNA");
        } else if (key.equals("M_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "UNA");
        } else if (key.equals("U_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "UNA");
        } else if (key.equals("W_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "UNA");
        }/*from   w ww. j  a va 2 s  .  c  o m*/
    }

    JFreeChart jfreechart = ChartFactory.createBarChart("Race Distribution - 2012", "Party", "% of votes",
            defaultcategorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();

    renderer.setDrawBarOutline(false);
    renderer.setSeriesPaint(0, Color.cyan);
    renderer.setSeriesPaint(1, Color.pink);
    renderer.setSeriesPaint(2, Color.red);
    renderer.setSeriesPaint(3, Color.orange);
    renderer.setSeriesPaint(4, Color.green);
    renderer.setSeriesPaint(5, Color.yellow);
    renderer.setSeriesPaint(6, Color.magenta);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
    renderer.setItemLabelsVisible(true);
    categoryplot.setRenderer(renderer);

    return jfreechart;

}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private void showProfile(String title, double[] xValues, double[] yValues, double[] yValues2) {
    Plot2 plot = new Plot2(title, "Frame", "Signal", xValues, yValues);
    double[] limits = Maths.limits(yValues);
    plot.setLimits(xValues[0], xValues[xValues.length - 1], limits[0], limits[1]);
    plot.draw();//  ww  w.j  av a  2 s. com

    plot.setColor(Color.red);
    plot.addPoints(xValues, yValues2, Plot2.LINE);

    plot.setColor(Color.magenta);

    // Add the on-frames
    if (!onFrames.isEmpty()) {
        double[] onx = new double[onFrames.size()];
        double[] ony = new double[onx.length];
        int c = 0;
        for (Spot s : onFrames) {
            onx[c] = s.frame;
            ony[c] = yValues[s.frame - 1];
            c++;
        }
        plot.addPoints(onx, ony, Plot2.CIRCLE);
    }

    // Add the candidate frames
    if (!candidateFrames.isEmpty()) {
        plot.setColor(Color.cyan);
        double[] onx = new double[candidateFrames.size()];
        double[] ony = new double[onx.length];
        int c = 0;
        for (int i : candidateFrames) {
            onx[c] = i;
            ony[c] = yValues[i - 1];
            c++;
        }
        plot.addPoints(onx, ony, Plot2.BOX);
        plot.setColor(Color.magenta);
    }

    // Overlay current position
    plot.addPoints(new double[] { rawImp.getCurrentSlice(), rawImp.getCurrentSlice() }, limits, Plot2.LINE);

    plot.setColor(Color.blue);
    Utils.display(title, plot);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java

public void addIsotopeCurves(TreeMap<Peak, Collection<Annotation>> annotations) {

    if (theDocument.size() == 0)
        return;/* ww  w .  j a v  a2 s. c om*/

    // remove old curves
    removeIsotopeCurves();

    // add curves
    if (annotations != null) {

        // set renderer
        if (show_all_isotopes) {
            thePlot.setRenderer(1, new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES));
            thePlot.getRenderer(1).setShape(new Ellipse2D.Double(0, 0, 7, 7));
        } else
            thePlot.setRenderer(1, new StandardXYItemRenderer(StandardXYItemRenderer.LINES));

        MSUtils.IsotopeList isotope_list = new MSUtils.IsotopeList(show_all_isotopes);
        for (Map.Entry<Peak, Collection<Annotation>> pa : annotations.entrySet()) {
            Peak p = pa.getKey();

            // get compositions
            HashSet<Molecule> compositions = new HashSet<Molecule>();
            for (Annotation a : pa.getValue()) {
                try {
                    compositions.add(a.getFragmentEntry().fragment.computeIon());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            // collect curves for this peak
            HashMap<String, double[][]> all_curves = new HashMap<String, double[][]>();
            for (Molecule m : compositions) {
                try {
                    double[][] data = MSUtils.getIsotopesCurve(1, m, show_all_isotopes);
                    // overlay the distribution with the existing list of isotopes
                    isotope_list.adjust(data, p.getMZ(), p.getIntensity());

                    all_curves.put(m.toString(), data);
                } catch (Exception e) {
                    LogUtils.report(e);
                }
            }

            // add average curve for this peak
            if (all_curves.size() > 1) {
                double[][] data = MSUtils.average(all_curves.values(), show_all_isotopes);
                // add the average to the chart
                String name = "average-" + p.getMZ();
                theIsotopesDataset.addSeries(name, data);
                thePlot.getRenderer(1).setSeriesPaint(theIsotopesDataset.indexOf(name), Color.magenta);
                thePlot.getRenderer(1).setSeriesStroke(theIsotopesDataset.indexOf(name), new BasicStroke(2));

                // add the average to the isotope list
                isotope_list.add(data, false);
            } else if (all_curves.size() == 1) {
                // add the only curve to the isotope list
                isotope_list.add(all_curves.values().iterator().next(), false);
            }

            // add the other curves
            for (Map.Entry<String, double[][]> e : all_curves.entrySet()) {
                String name = e.getKey() + "-" + p.getMZ();
                theIsotopesDataset.addSeries(name, e.getValue());
                thePlot.getRenderer(1).setSeriesPaint(theIsotopesDataset.indexOf(name), Color.blue);
            }
        }
    }
    updateIntensityAxis();
}

From source file:edu.ucla.stat.SOCR.analyses.gui.Survival.java

protected void doGraph() {
    graphPanel.removeAll();//w ww.  jav  a 2  s  .com
    ////////System.out.println("in doGraph");
    //graphPanel.add(description, BorderLayout.SOUTH);
    JFreeChart scatterChart = null;
    ChartPanel chartPanel1 = null;
    ChartPanel chartPanel2 = null;
    Chart chartFactory = new Chart();
    String lineType = "excludesZeroNoShape";
    /*
          double[] survivalTimePlot = new double[plotSize];
          double[] survivalRatePlot = new double[plotSize];
          //////////System.out.println("doGraph survivalTimePlot.length = " + survivalTimePlot.length);
          //////////System.out.println("doGraph survivalRatePlot.length = " + survivalRatePlot.length);
          int newIndex = 0;
          for (int i = 0; i < survivalRate.length; i++) {
             for (int j = 0; j < survivalRate[i].length; j++) {
    survivalTimePlot[newIndex] = survivalTime[i][j];
    survivalRatePlot[newIndex] = survivalRate[i][j];
    newIndex++;
             }
            
          }
    */
    /*
            
          double[][] survivalTimePlot = new double[survivalTime.length][];
          double[][] survivalRatePlot = new double[survivalRate.length][];
          // create the first point (time = 0, rate = 1)
          for (int i = 0; i < survivalTime.length; i++) {
             survivalTimePlot[i] = new double[survivalTime[i].length + 1];
             survivalRatePlot[i] = new double[survivalRate[i].length + 1];
             survivalTimePlot[i][0] = 0;
             survivalRatePlot[i][0] = 1;
             for (int j = 1; j < survivalTimePlot[i].length; j++) {
    survivalTimePlot[i][j] = survivalTime[i][j - 1];
    survivalRatePlot[i][j] = survivalRate[i][j - 1];
             }
          }
    */
    boolean useCI = true; // whether to plot the confidence interval.
    ////////System.out.println("useCI = " + useCI);
    double[][] survivalTimePlot = new double[survivalTime.length][];
    double[][] survivalRatePlot = new double[survivalRate.length][];
    double[][] survivalRateUpperCIPlot = new double[survivalRate.length][];
    double[][] survivalRateLowerCIPlot = new double[survivalRate.length][];

    // create the first point (time = 0, rate = 1)
    double tempTime = 0, tempRate = 0, tempRateUpperCI = 0, tempRateLowerCI = 0;
    int increment = 2;
    int arrayLength = 0;
    int k = 0; // index for survivalTime array, not for survivalTimePlot.
    for (int i = 0; i < survivalTime.length; i++) {
        arrayLength = 2 * survivalRate[i].length + increment;
        k = 0;
        // why add 2? one for the initial point, one for the last point.
        survivalTimePlot[i] = new double[arrayLength];
        survivalRatePlot[i] = new double[arrayLength];

        survivalRateUpperCIPlot[i] = new double[arrayLength];
        survivalRateLowerCIPlot[i] = new double[arrayLength];

        survivalTimePlot[i][0] = 0;
        survivalRatePlot[i][0] = 1;

        survivalRateUpperCIPlot[i][0] = 1;
        survivalRateLowerCIPlot[i][0] = 1;
        int j = 1;
        ////////System.out.println(" before loop survivalTimePlot["+i+"].length= " +survivalTimePlot[i].length);
        for (j = 1; j < survivalTimePlot[i].length - 1; j++) {
            //////////System.out.println("j = " + j + " survivalTimePlot["+i+"].length = " + survivalTimePlot[i].length + ", k = " + k);
            ////////System.out.println("in loop j = " + j);
            if (j % 2 == 1) {

                ////////System.out.println("in if j = " + j + ", k = " + k);
                survivalTimePlot[i][j] = survivalTime[i][k];
                survivalRatePlot[i][j] = survivalRatePlot[i][j - 1];
                survivalRateUpperCIPlot[i][j] = survivalRateUpperCIPlot[i][j - 1];
                survivalRateLowerCIPlot[i][j] = survivalRateLowerCIPlot[i][j - 1];

                tempTime = survivalTimePlot[i][j];
                tempRate = survivalRatePlot[i][j];
                tempRateUpperCI = survivalRateUpperCIPlot[i][j];
                tempRateLowerCI = survivalRateLowerCIPlot[i][j];

            } else {
                //////////System.out.println("in elsej = " + j);
                survivalTimePlot[i][j] = tempTime;
                survivalRatePlot[i][j] = survivalRate[i][k];
                survivalRateUpperCIPlot[i][j] = upperCI[i][k];
                survivalRateLowerCIPlot[i][j] = lowerCI[i][k];

                k++;

            }
            ////////System.out.println("i = " + i + ", j = " + j + ", k = " + k + ", time["+i+"]["+j+"] = " + survivalTimePlot[i][j] + ". rate["+i+"]["+j+"] = " + survivalRatePlot[i][j]);

        }
        int index = j;//survivalTimePlot[i].length-1;//survivalTimePlot[i].length;
        ////////System.out.println("index = " + index);
        ////////System.out.println("maxTime["+i+"] = " + maxTime[i]);

        survivalTimePlot[i][index] = maxTime[i];

        ////////System.out.println("survivalTimePlot["+i+"]["+index+"] = " + survivalTimePlot[i][index]);

        survivalRatePlot[i][index] = survivalRatePlot[i][index - 1];

        survivalRateUpperCIPlot[i][index] = survivalRateUpperCIPlot[i][index - 1];
        survivalRateLowerCIPlot[i][index] = survivalRateLowerCIPlot[i][index - 1];

    }

    int numberGroups = 0, lineSetCount = 0, tempIndex = 0;
    double[][] finalTimeArray = null;
    double[][] finalRateArray = null;
    String[] finalGroupNames = null;
    int numberOfLines = 0;
    //lineSetCount * groupNames.length;
    Color[] colorArray = null;//new Color[numberOfLines];
    ////////System.out.println("lineSetCount = " + lineSetCount);
    if (useCI) {
        numberGroups = groupNames.length;

        lineSetCount = 3; // use 4 if using censor points.
        tempIndex = 0;
        numberOfLines = lineSetCount * numberGroups;
        finalTimeArray = new double[numberOfLines][];
        finalRateArray = new double[numberOfLines][];
        finalGroupNames = new String[numberOfLines];
        ////////System.out.println("numberOfLines = " + numberOfLines);
        colorArray = new Color[numberOfLines];
        // why 3? one for rate, one for upper CI, one for lower CI.

        for (int i = 0; i < numberGroups; i++) {
            // repeat the same time.
            finalTimeArray[tempIndex] = survivalTimePlot[i];
            finalTimeArray[tempIndex + 1] = survivalTimePlot[i];
            finalTimeArray[tempIndex + 2] = survivalTimePlot[i];
            //finalTimeArray[tempIndex+3] = censoredTime[i];

            finalRateArray[tempIndex] = survivalRatePlot[i];
            finalRateArray[tempIndex + 1] = survivalRateUpperCIPlot[i];
            finalRateArray[tempIndex + 2] = survivalRateLowerCIPlot[i];
            //finalRateArray[tempIndex+3] = censoredRate[i];

            finalGroupNames[tempIndex] = groupNames[i];
            finalGroupNames[tempIndex + 1] = groupNames[i] + " Upper CI";
            finalGroupNames[tempIndex + 2] = groupNames[i] + " Lower CI";
            //finalGroupNames[tempIndex+3] = groupNames[i] + " Censored";
            if (i % 5 == 0) {
                colorArray[tempIndex] = Color.RED;
                colorArray[tempIndex + 1] = Color.PINK;
                colorArray[tempIndex + 2] = Color.PINK;

            } else if (i % 5 == 1) {
                colorArray[tempIndex] = Color.BLUE;
                colorArray[tempIndex + 1] = Color.CYAN;
                colorArray[tempIndex + 2] = Color.CYAN;

            } else if (i % 5 == 2) {
                colorArray[tempIndex] = Color.GRAY;
                colorArray[tempIndex + 1] = Color.LIGHT_GRAY;
                colorArray[tempIndex + 2] = Color.LIGHT_GRAY;

            } else if (i % 5 == 3) {
                colorArray[tempIndex] = Color.MAGENTA;
                colorArray[tempIndex + 1] = Color.PINK;
                colorArray[tempIndex + 2] = Color.PINK;

            } else {
                colorArray[tempIndex] = Color.GREEN;
                colorArray[tempIndex + 1] = Color.YELLOW;
                colorArray[tempIndex + 2] = Color.YELLOW;
            }

            tempIndex += lineSetCount;

        }
    } else {
        numberGroups = groupNames.length;

        lineSetCount = 2;
        tempIndex = 0;
        finalTimeArray = new double[lineSetCount * numberGroups][];
        finalRateArray = new double[lineSetCount * numberGroups][];
        finalGroupNames = new String[lineSetCount * numberGroups];

        // why 3? one for rate, one for upper CI, one for lower CI.

        for (int i = 0; i < numberGroups; i++) {
            // repeat the same time.
            finalTimeArray[tempIndex] = survivalTimePlot[i];
            finalTimeArray[tempIndex + 1] = censoredTime[i];

            finalRateArray[tempIndex] = survivalRatePlot[i];
            finalRateArray[tempIndex + 1] = censoredRate[i];

            finalGroupNames[tempIndex] = groupNames[i];
            //finalGroupNames[tempIndex+1] = groupNames[i] + " Censored";

            tempIndex += lineSetCount;
        }

    }

    //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", groupNames.length, groupNames, survivalTimePlot, survivalRatePlot, lineType);
    //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", lineSetCount * groupNames.length, finalGroupNames, finalTimeArray, finalRateArray, lineType); // this one has color.

    //public JFreeChart getLineChart(String title, String xLabel, String yLabel, double[] x, double[] y, Color[] colors,  String other)

    //public JFreeChart getLineChart(String title, String xLabel, String yLabel, int numberOfLines, String[] lineNames, double[][] x, double[][] y, Color[] colors, String other)
    //int numberOfLines = lineSetCount * groupNames.length;
    //Color[] colors = new Color[numberOfLines];

    //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", numberOfLines, finalGroupNames, finalTimeArray, finalRateArray, colorArray, lineType);

    scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", lineSetCount * groupNames.length,
            finalGroupNames, finalTimeArray, finalRateArray, colorArray, lineType); // this one has color.

    //for (int i = 0; i < survivalTime.length; i++) {
    //scatterChart  = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", survivalTimePlot, survivalRatePlot, lineType);
    //}
    scatterChart.setTitle("Expected Survival Times with 95% Confidence Limits");
    chartPanel1 = new ChartPanel(scatterChart, false);
    chartPanel1.setPreferredSize(new Dimension(plotWidth, plotHeight));

    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    innerPanel.add(chartPanel1);

    // Add a second plot without the confidence intervals (confidence limits)
    int lineSetCount1 = lineSetCount - 2;
    int tempIndex1 = 0;
    double[][] finalTimeArray1 = new double[lineSetCount1 * numberGroups][];
    double[][] finalRateArray1 = new double[lineSetCount1 * numberGroups][];
    String[] finalGroupNames1 = new String[lineSetCount1 * numberGroups];
    for (int i = 0; i < numberGroups; i++) {
        // repeat the same time.
        finalTimeArray1[tempIndex1] = survivalTimePlot[i];
        //finalTimeArray1[tempIndex1+1] = censoredTime[i];
        finalRateArray1[tempIndex1] = survivalRatePlot[i];
        //finalRateArray1[tempIndex1+1] = censoredRate[i];
        finalGroupNames1[tempIndex1] = groupNames[i];
        tempIndex1 += lineSetCount1;
    }
    JFreeChart scatterChart1 = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate",
            (lineSetCount1) * groupNames.length, finalGroupNames1, finalTimeArray1, finalRateArray1, colorArray,
            lineType); // this one has color.
    scatterChart1.setTitle("Expected Survival Times (Only)");
    chartPanel2 = new ChartPanel(scatterChart1, false);
    chartPanel2.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel2);

    graphPanel.validate();

}