/** Customised plot functions. */ public void plotx() { // way1: through the JGunplot.plotx field. JGnuplot jg = new JGnuplot(); jg.plotx = "$header$\n plot for [i=1:$size(1)$] '-' title info2(1,i).' plotx' w lp ls i\n $data(1)$"; jg.execute(plot1, jg.plotx); // way2: through a sub class extending JGunplot class JGnuplot2 extends JGnuplot { public String myplot, rawcode; public boolean initialize() { String sFLoad2 = "jgnuplot2.xml"; U.copyFileFromClassPath(this, sFLoad2, sFLoad2, false); // this also works in a jar file return U.loadFromXML(this, sFLoad2, false); } } JGnuplot2 jg2 = new JGnuplot2(); jg2.execute(plot1, jg2.myplot); jg2.execute(new Plot(null), jg2.rawcode); }
public void terminals() { class JGnuplot2 extends JGnuplot { // windows terminal is only available to windows. You might get error output from gnuplot if // you are not using windows. String terminal = "windows enhanced dashed title 'id=100 hello there' size 600,600"; String output = null; // String beforeStyle="linewidth=4"; } JGnuplot2 jg = new JGnuplot2(); jg.execute(plot1, jg.plot2d, ~jg.JG_DeleteTempFile); jg.terminal = null; jg.execute(plot1, jg.plot2d); // wxt terminal default size 640,384 jg.terminal = "dumb"; // ascii art terminal for anything that prints text jg.execute(plot1, jg.plot2d); jg.terminal = "jpeg enhanced size 600,600"; jg.output = "'plot1.jpg'"; jg.execute(plot1, jg.plot2d); jg.terminal = "pngcairo enhanced dashed size 600,600"; jg.output = "'plot1.png'"; jg.execute(plot1, jg.plot2d); jg.output = "'plot2.png'"; jg.execute(plot2, jg.plot3d); // the size unit for pdf is Inch. It is different from other terminals. The default pdf size is // 5,3. jg.terminal = "pdfcairo enhanced dashed size 6,6"; jg.output = "'plot1.pdf'"; jg.execute(plot1, jg.plot2d); jg.output = "'plot2.pdf'"; jg.execute(plot2, jg.plot3d); jg.output = "'plot3.pdf'"; jg.execute(plot1, jg.multiplot); }