import statgraphics.regression.lm.LinearRegressionPlot;

import statgraphics.util.*;

 

/**

 *

 * <p>Example: class LinearRegressionPlot.</p>

 */

 

double[] ydata = {58, 105, 88, 118, 117, 137, 157, 169, 149, 202};

double[] xdata = {2, 6, 8, 8, 12, 16, 20, 20, 22, 26};

double[] p1 = {0, 60};

double[] p2 = {30, 210};

String title = "Y = 60 + 5X ";

String xLabel = "Student Population";

String yLabel = "Quarterly Sales";

pf = new PlotFrame[2];

pf[0] = new PlotFrame("Regression Plot I",

                    new LinearRegressionPlot(title, xLabel, yLabel,

                    p1, p2, xdata, ydata).plot, 500, 270);

pf[1] = new PlotFrame("Regression Plot II",

                    new LinearRegressionPlot("Pizza Data", xLabel, yLabel,

                    p1, p2, xdata, ydata).getPlot(), 500, 270);

new PlotFrameFactory().putPlotFrame(pf);

 

Results: