Package eas.math.gnuplot2

Examples of eas.math.gnuplot2.JGnuplot


      //Quotation inside is necessary for xlabel and other fields cause you could add more config code
      String xlabel = "'x axis' textcolor rgbcolor 'dark-red'", ylabel = "'y axis'", extra = "set key top left";
    };
    //DataTableSet 1 2d add data one by one
    DataTableSet dts1 = plot1.addNewDataTableSet("DataTableSet 2d");//use null to avoid the output of figure title for this dataset.
    DataTable dt1 = dts1.addNewDataTable("x", 2);
    DataTable dt2 = dts1.addNewDataTable("2x", 2);
    DataTable dt3 = dts1.addNewDataTable("3x", 2);
    DataTable dt4 = dts1.addNewDataTable("4x", 2);
    DataTable dt5 = dts1.addNewDataTable("5x", 2);
    DataTable dt6 = dts1.addNewDataTable("6x", 2);
    DataTable dt7 = dts1.addNewDataTable("7x", 2);
    DataTable dt8 = dts1.addNewDataTable("8x", 2);
    DataTable dt9 = dts1.addNewDataTable("9x", 2);
    DataTable dt10 = dts1.addNewDataTable("10x", 2);
    for (int i = 0; i < 5; i++) {
      dt1.add(i, i);
      dt2.add(i, 2 * i);
      dt3.add(i, 3 * i);
      dt4.add(i, 4 * i);
      dt5.add(i, 5 * i);
      dt6.add(i, 6 * i);
      dt7.add(i, 7 * i);
      dt8.add(i, 8 * i);
      dt9.add(i, 9 * i);
      dt10.add(i, 10 * i);
    }
    //DataTableSet 2 3d add data using prepared lists
    DataTableSet dts2 = plot1.addNewDataTableSet("DataTableSet 3d");
    List x = new ArrayList(), y = new ArrayList(), z1 = new ArrayList(), z2 = new ArrayList();
    for (double i = -2; i <= 2; i += 0.5) {
View Full Code Here


      //String terminal, output, xrange, yrange, zrange;
      //Quotation inside is necessary for xlabel and other fields cause you could add more config code
      String xlabel = "'x axis' textcolor rgbcolor 'dark-red'", ylabel = "'y axis'", extra = "set key top left";
    };
    //DataTableSet 1 2d add data one by one
    DataTableSet dts1 = plot1.addNewDataTableSet("DataTableSet 2d");//use null to avoid the output of figure title for this dataset.
    DataTable dt1 = dts1.addNewDataTable("x", 2);
    DataTable dt2 = dts1.addNewDataTable("2x", 2);
    DataTable dt3 = dts1.addNewDataTable("3x", 2);
    DataTable dt4 = dts1.addNewDataTable("4x", 2);
    DataTable dt5 = dts1.addNewDataTable("5x", 2);
    DataTable dt6 = dts1.addNewDataTable("6x", 2);
    DataTable dt7 = dts1.addNewDataTable("7x", 2);
    DataTable dt8 = dts1.addNewDataTable("8x", 2);
    DataTable dt9 = dts1.addNewDataTable("9x", 2);
    DataTable dt10 = dts1.addNewDataTable("10x", 2);
    for (int i = 0; i < 5; i++) {
      dt1.add(i, i);
      dt2.add(i, 2 * i);
      dt3.add(i, 3 * i);
      dt4.add(i, 4 * i);
      dt5.add(i, 5 * i);
      dt6.add(i, 6 * i);
      dt7.add(i, 7 * i);
      dt8.add(i, 8 * i);
      dt9.add(i, 9 * i);
      dt10.add(i, 10 * i);
    }
    //DataTableSet 2 3d add data using prepared lists
    DataTableSet dts2 = plot1.addNewDataTableSet("DataTableSet 3d");
    List x = new ArrayList(), y = new ArrayList(), z1 = new ArrayList(), z2 = new ArrayList();
    for (double i = -2; i <= 2; i += 0.5) {
      for (double j = -2; j <= 2; j += 0.5) {
        x.add(i);
        y.add(j);
        z1.add(i * i + j * j);
        z2.add(4 + i * i + j * j);
      }
    }
    dts2.addNewDataTable("x^2+y^2", x, y, z1);
    dts2.addNewDataTable("4+x^2+y^2", x, y, z2);
    DataTableSet dts3 = dts1;
    plot1.add(dts3);

    plot2 = new Plot("plot2") {
      String zlabel = "'z axis'";
    };
View Full Code Here

            @Override public void mouseExited(MouseEvent e) {}
            @Override public void mouseEntered(MouseEvent e) {}
           
            @Override
            public void mouseClicked(MouseEvent e) {
                JGnuplot plot = new JGnuplot();
                Command c = plot.execute(
                        new Plot("test"),
                        PlainGNUPlot.this.plotCode.substring(PlainGNUPlot.this
                                .getPDFProcessor().getCodePrefix().length()),
                        null);
                c.toString();
View Full Code Here

    @Override
    public void storeAsPDF(String datNam, String tempDir) {
        String pdfSettings = "set terminal pdf\n"
                           + "set output '" + tempDir + "/" + datNam + ".pdf'\n";
        JGnuplot plot = new JGnuplot();
       
        plot.execute(new Plot("test"), pdfSettings + this.gnuplotCode.substring(this.getCodePrefix().length()), tempDir);
    }
View Full Code Here

    prepPlot();
    return rtn;
  }

  public void prepPlot() {
    plot1 = new Plot("plot1") {//No need to declare public/protected/private for these fields.
      //String terminal, output, xrange, yrange, zrange;
      //Quotation inside is necessary for xlabel and other fields cause you could add more config code
      String xlabel = "'x axis' textcolor rgbcolor 'dark-red'", ylabel = "'y axis'", extra = "set key top left";
    };
    //DataTableSet 1 2d add data one by one
    DataTableSet dts1 = plot1.addNewDataTableSet("DataTableSet 2d");//use null to avoid the output of figure title for this dataset.
    DataTable dt1 = dts1.addNewDataTable("x", 2);
    DataTable dt2 = dts1.addNewDataTable("2x", 2);
    DataTable dt3 = dts1.addNewDataTable("3x", 2);
    DataTable dt4 = dts1.addNewDataTable("4x", 2);
    DataTable dt5 = dts1.addNewDataTable("5x", 2);
    DataTable dt6 = dts1.addNewDataTable("6x", 2);
    DataTable dt7 = dts1.addNewDataTable("7x", 2);
    DataTable dt8 = dts1.addNewDataTable("8x", 2);
    DataTable dt9 = dts1.addNewDataTable("9x", 2);
    DataTable dt10 = dts1.addNewDataTable("10x", 2);
    for (int i = 0; i < 5; i++) {
      dt1.add(i, i);
      dt2.add(i, 2 * i);
      dt3.add(i, 3 * i);
      dt4.add(i, 4 * i);
      dt5.add(i, 5 * i);
      dt6.add(i, 6 * i);
      dt7.add(i, 7 * i);
      dt8.add(i, 8 * i);
      dt9.add(i, 9 * i);
      dt10.add(i, 10 * i);
    }
    //DataTableSet 2 3d add data using prepared lists
    DataTableSet dts2 = plot1.addNewDataTableSet("DataTableSet 3d");
    List x = new ArrayList(), y = new ArrayList(), z1 = new ArrayList(), z2 = new ArrayList();
    for (double i = -2; i <= 2; i += 0.5) {
      for (double j = -2; j <= 2; j += 0.5) {
        x.add(i);
        y.add(j);
        z1.add(i * i + j * j);
        z2.add(4 + i * i + j * j);
      }
    }
    dts2.addNewDataTable("x^2+y^2", x, y, z1);
    dts2.addNewDataTable("4+x^2+y^2", x, y, z2);
    DataTableSet dts3 = dts1;
    plot1.add(dts3);

    plot2 = new Plot("plot2") {
      String zlabel = "'z axis'";
    };
    plot2.add(dts2);
  }
View Full Code Here

    return rtn;
  }

  public void simple() {
    JGnuplot jg = new JGnuplot();
    Plot plot0 = new Plot("simpleplot") {
      String xlabel = "'x'", ylabel = "'y'";
    };
    double[] x = { 1, 2, 3, 4, 5 }, y1 = { 2, 4, 6, 8, 10 }, y2 = { 3, 6, 9, 12, 15 };
    DataTableSet dts = plot0.addNewDataTableSet("Simple plot");
    dts.addNewDataTable("2x", x, y1);
    dts.addNewDataTable("3x", x, y2);
    jg.execute(plot0, jg.plot2d, TEMP_DIR);
  }
View Full Code Here

    dts.addNewDataTable("3x", x, y2);
    jg.execute(plot0, jg.plot2d, TEMP_DIR);
  }

  public void prepPlot() {
    plot1 = new Plot("plot1") {//No need to declare public/protected/private for these fields.
      //String terminal, output, xrange, yrange, zrange;
      //Quotation inside is necessary for xlabel and other fields cause you could add more config code
      String xlabel = "'x axis' textcolor rgbcolor 'dark-red'", ylabel = "'y axis'", extra = "set key top left";
    };
    //DataTableSet 1 2d add data one by one
    DataTableSet dts1 = plot1.addNewDataTableSet("DataTableSet 2d");//use null to avoid the output of figure title for this dataset.
    DataTable dt1 = dts1.addNewDataTable("x", 2);
    DataTable dt2 = dts1.addNewDataTable("2x", 2);
    DataTable dt3 = dts1.addNewDataTable("3x", 2);
    DataTable dt4 = dts1.addNewDataTable("4x", 2);
    DataTable dt5 = dts1.addNewDataTable("5x", 2);
    DataTable dt6 = dts1.addNewDataTable("6x", 2);
    DataTable dt7 = dts1.addNewDataTable("7x", 2);
    DataTable dt8 = dts1.addNewDataTable("8x", 2);
    DataTable dt9 = dts1.addNewDataTable("9x", 2);
    DataTable dt10 = dts1.addNewDataTable("10x", 2);
    for (int i = 0; i < 5; i++) {
      dt1.add(i, i);
      dt2.add(i, 2 * i);
      dt3.add(i, 3 * i);
      dt4.add(i, 4 * i);
      dt5.add(i, 5 * i);
      dt6.add(i, 6 * i);
      dt7.add(i, 7 * i);
      dt8.add(i, 8 * i);
      dt9.add(i, 9 * i);
      dt10.add(i, 10 * i);
    }
    //DataTableSet 2 3d add data using prepared lists
    DataTableSet dts2 = plot1.addNewDataTableSet("DataTableSet 3d");
    List x = new ArrayList(), y = new ArrayList(), z1 = new ArrayList(), z2 = new ArrayList();
    for (double i = -2; i <= 2; i += 0.5) {
      for (double j = -2; j <= 2; j += 0.5) {
        x.add(i);
        y.add(j);
        z1.add(i * i + j * j);
        z2.add(4 + i * i + j * j);
      }
    }
    dts2.addNewDataTable("x^2+y^2", x, y, z1);
    dts2.addNewDataTable("4+x^2+y^2", x, y, z2);
    DataTableSet dts3 = dts1;
    plot1.add(dts3);

    plot2 = new Plot("plot2") {
      String zlabel = "'z axis'";
    };
    plot2.add(dts2);
  }
View Full Code Here

        return U.loadFromXML(this, sFLoad2, false);
      }
    }
    JGnuplot2 jg2 = new JGnuplot2();
    jg2.execute(plot1, jg2.myplot, TEMP_DIR);
    jg2.execute(new Plot(null), jg2.rawcode, TEMP_DIR);
  }
View Full Code Here

           
            @Override
            public void mouseClicked(MouseEvent e) {
                JGnuplot plot = new JGnuplot();
                Command c = plot.execute(
                        new Plot("test"),
                        PlainGNUPlot.this.plotCode.substring(PlainGNUPlot.this
                                .getPDFProcessor().getCodePrefix().length()),
                        null);
                c.toString();
//                System.out.println(c.tLock.toString());
View Full Code Here

    public void storeAsPDF(String datNam, String tempDir) {
        String pdfSettings = "set terminal pdf\n"
                           + "set output '" + tempDir + "/" + datNam + ".pdf'\n";
        JGnuplot plot = new JGnuplot();
       
        plot.execute(new Plot("test"), pdfSettings + this.gnuplotCode.substring(this.getCodePrefix().length()), tempDir);
    }
View Full Code Here

TOP

Related Classes of eas.math.gnuplot2.JGnuplot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.