import statgraphics.eda.LinePlot;

import statgraphics.util.*;

 

/**

 *

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

 */

 

pf = new PlotFrame[4];

String[] category = {"2001", "2002", "2003", "2004", "2005"};

double[][] data = { {13, 12, 11, 8, 7}, {6, 11, 12, 11, 10},

                {4, 5, 7, 9, 13} };

String[] dataNames = {"Company A", "Company B", "Company C"};

linePlot = new LinePlot(dataNames, "Computer Purchases",

                     "Company", "Sales",

                     category, data);

pf[0] = new PlotFrame("Line Plot", linePlot.getPlot(), 500, 270);

       

double[][] sortXData = { {9, 14, 19, 24, 29, 34},

                     {11, 13, 17, 22, 26, 28, 31} };

double[][] sortYData = { {0, 4, 12, 17, 19, 20},

                     {0, 2, 10, 13, 15, 16, 18} };

String[] dataNames2 = {"Company A", "Company B"};

linePlot = new LinePlot(dataNames2, "Ogive Plot", "Audit Time in Days",

                     "Cumulative Frequency", sortXData, sortYData);

pf[1] = new PlotFrame("Ogive Plot", linePlot.getPlot());

 

double[] variance = {3.59, 1.63, 1.11, 0.70, 0.38, 0.30, 0.14, 0.11};

String[] componentList = {"Comp. 1", "Comp. 2", "Comp. 3", "Comp. 4",

                       "Comp. 5", "Comp. 6", "Comp. 7", "Comp. 8"};

String dataNames3 = "Component";

linePlot = new LinePlot(dataNames3, "Principal Component Analysis",

                     "Principal Component", "Variance",

                     componentList, variance);

pf[2] = new PlotFrame("Scree Plot", linePlot.getPlot(), 500, 270);

 

double[][] xData = new double[2][2000];

double[][] yData = new double[2][2000];

String[] dataNames4 = {"Power function", "Sine Function"};

for (int j = 0; j < 2; j++)

{

    if (j == 0)

    {

        for (int i = 0; i < 2000; i++)

        {

            xData[j][i] = -10 + 0.01 * i;

            yData[j][i] = Math.pow(xData[j][i], 2.0);

        }

    }

    else

    {

        for (int i = 0; i < 2000; i++)

        {

            xData[j][i] = -20 + 0.02 * i;

            yData[j][i] = 100 * Math.sin(xData[j][i]);

        }

    }

}

linePlot = new LinePlot(dataNames4, "Mathematical Functions", "x",

                     "f(x)", xData, yData);

pf[3] = new PlotFrame("Math. Fun.", linePlot.plot);

 

new PlotFrameFactory().putPlotFrame(pf);

 

Results:

 

 

 

 

See also:

Summarizing Quantitative Data