Plotting in java

For java-programming I use Eclipse, a very nice, professional IDE. To show intermediate and final results I needed a plotting package. Just for fun I decided to write my own package. Let's try to plot a sine as a first test.

The main program:

package plotSine;

public class MainGUI {
	private Engine myEngine;
	
	public MainGUI() {
		myEngine = new Engine();
		myEngine.plotSine();
	}
	
	static public void main(String args[]) {
		new MainGUI();
	}
}

and the engine:

package plotSine;

import util.ShowPlot2d;

public class Engine {

	public void plotSine(){
// plot sine as a first simple experiment
        
        double[] plotData = new double[19];
        for (int i = 0; i < 19; i = i + 1)
        {
            int ix = i * 20;
            double arg = 2 * Math.PI * ix / 360;
            double y = Math.sin(arg);          
            plotData[i] = y;
        }
        
        int numberOfPlots = 1;
        ShowPlot2d myPlot = new ShowPlot2d(numberOfPlots);
        double scaleFactor = 150;
        myPlot.add(plotData, scaleFactor, "just a sinewave");
        myPlot.showFigure();
	}
}

and the picture:

plotSine (60K) height="364" width="683"