SubPlot.java
01 /*
02  * $Id: SubPlot.java,v 1.15 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.matrix.misc.LinearlySpacedVector;
13 import org.mklab.nfc.util.Pause;
14 import org.mklab.tool.graph.gnuplot.Gnuplot;
15 
16 
17 /**
18  @author koga
19  @version $Revision: 1.15 $, 2004/05/01
20  */
21 public class SubPlot {
22 
23   /**
24    * メインメソッド
25    
26    @param args コマンドライン引数
27    @throws InterruptedException 強制終了された場合
28    @throws IOException キーボードから入力できない場合
29    */
30   @SuppressWarnings("nls")
31   public static void main(String[] argsthrows InterruptedException, IOException {
32     DoubleMatrix w = LinearlySpacedVector.create(Math.PI, Math.PI);
33     DoubleMatrix s = w.sinElementWise();
34     DoubleMatrix c = w.cosElementWise();
35     Gnuplot gnuplot = new Gnuplot();
36     gnuplot.createCanvas(22);
37     gnuplot.getCanvas(00).plot(w, s, new String[] {"sin(x)"});
38     gnuplot.getCanvas(01).plot(w, c, new String[] {"cos(x)"});
39     gnuplot.getCanvas(10).plot(w, s.multiply(2)new String[] {"2*sin(x)"});
40     gnuplot.getCanvas(11).plot(w, c.multiply(2)new String[] {"2*cos(x)"});
41     Pause.pause();
42     gnuplot.close();
43   }
44 }