public void plot(int n){
        if(n>2)throw new IllegalArgumentException("Argument n, " + n +", must be less than 3");

        double[] xAxis = new double[this.length];
        for(int i=0; i<this.length; i++)xAxis[i] = i;
        double[] yAxis = this.getArray_as_double();


        PlotGraph pg = new PlotGraph(xAxis, yAxis);
        pg.setGraphTitle("ArrayMaths plot method");
        pg.setXaxisLegend("Array element index");
        pg.setYaxisLegend("Array element value");
        pg.setPoint(1);
        switch(n){
            case 0: pg.setLine(0);
                    pg.setGraphTitle2("Points only - no line");
                    break;
            case 1: pg.setLine(3);
                    pg.setGraphTitle2("Points joined by straight lines");
                    break;
            case 2: pg.setLine(1);
                    pg.setGraphTitle2("Points joined by cubic spline interpolated line");
                    break;
            default: throw new IllegalArgumentException("Should not be possible to get here!!!");
        }
        pg.plot();
    }