コード例 #1
0
ファイル: StaircasePlot.java プロジェクト: vimsh/jmathplot
  public static void main(String[] args) {
    Plot2DPanel p = new Plot2DPanel();

    double[] X = new double[10];
    double[] Y = new double[10];
    for (int j = 0; j < X.length; j++) {
      X[j] = j;
      Y[j] = Math.random();
    }
    p.addStaircasePlot("toto", X, Y);

    new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Color[] c = new Color[10];

    p = new Plot2DPanel();

    X = new double[10];
    Y = new double[10];
    for (int j = 0; j < X.length; j++) {
      X[j] = j;
      Y[j] = Math.random();
      c[j] = new Color((int) (Math.random() * 0x1000000));
    }
    p.addStaircasePlot("toto", c, X, Y);

    new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
コード例 #2
0
ファイル: LinePlot.java プロジェクト: fjtsai/jlabgroovy
  public static void main(String[] args) {
    Plot2DPanel p2 = new Plot2DPanel();

    double[][] XYZ = new double[100][2];
    for (int j = 0; j < XYZ.length; j++) {
      XYZ[j][0] = 2 * Math.PI * (double) j / XYZ.length;
      XYZ[j][1] = Math.sin(XYZ[j][0]);
    }
    double[][] XYZ2 = new double[100][2];
    for (int j = 0; j < XYZ2.length; j++) {
      XYZ2[j][0] = 2 * Math.PI * (double) j / XYZ.length;
      XYZ2[j][1] = Math.sin(2 * XYZ2[j][0]);
    }

    p2.addLinePlot("sin", Color.RED, AbstractDrawer.DOTTED_LINE, XYZ);
    p2.setBackground(new Color(200, 0, 0));
    p2.addLinePlot("sin2", Color.BLUE, AbstractDrawer.CROSS_DOT, XYZ2);

    p2.setLegendOrientation(PlotPanel.SOUTH);
    new FrameView(p2).setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    Plot3DPanel p = new Plot3DPanel();

    XYZ = new double[100][3];
    for (int j = 0; j < XYZ.length; j++) {
      XYZ[j][0] = 2 * Math.PI * (double) j / XYZ.length;
      XYZ[j][1] = Math.sin(XYZ[j][0]);
      XYZ[j][2] = Math.sin(XYZ[j][0]) * Math.cos(XYZ[j][1]);
    }
    p.addLinePlot("toto", XYZ);

    p.setLegendOrientation(PlotPanel.SOUTH);
    new FrameView(p).setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  }
コード例 #3
0
 public static void main(String[] args) {
   double[] X = new double[500];
   for (int i = 0; i < X.length; i++) {
     X[i] = Math.random() + Math.random();
   }
   Plot2DPanel p = new Plot2DPanel("SOUTH");
   p.addHistogramPlot("test", X, 10);
   new FrameView(p);
 }