01 /*
02 * $Id: TitleGridLabel.java,v 1.13 2008/02/02 03:06:27 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap12;
08
09 import java.io.IOException;
10
11 import org.mklab.nfc.matrix.DoubleMatrix;
12 import org.mklab.nfc.util.Pause;
13 import org.mklab.tool.graph.gnuplot.Canvas;
14 import org.mklab.tool.graph.gnuplot.Gnuplot;
15
16
17 /**
18 * @author koga
19 * @version $Revision: 1.13 $, 2004/05/01
20 */
21 public class TitleGridLabel {
22
23 /**
24 * メインメソッド
25 *
26 * @param args コマンドライン引数
27 * @throws InterruptedException 強制終了された場合
28 * @throws IOException キーボードから入力できない場合
29 */
30 @SuppressWarnings("nls")
31 public static void main(String[] args) throws InterruptedException, IOException {
32 DoubleMatrix t = DoubleMatrix.series(0, 4 * Math.PI, 0.05);
33 DoubleMatrix s = t.sinElementWise();
34 Gnuplot gnuplot = new Gnuplot();
35 Canvas canvas = gnuplot.createCanvas();
36 canvas.plot(t, s, new String[] {"sin(t)"});
37 canvas.setGridVisible(true);
38 canvas.setXLabel("time [s]");
39 canvas.setYLabel("y");
40 canvas.setTitle("Sinusoidal Wave");
41 canvas.setText("Sample for text()", 7.0, 0.1);
42 Pause.pause();
43 gnuplot.close();
44 }
45 }
|