Maybe this is not the right place, but I try to post here my work because I cannot find anything under version control repository.
I tried to modify the Plot class in order to have the chance to use the command
splot "filename" matrix with lines
by which having a three-dimensional plot of a matrix represented in filename.
- Added method newPlot(Plots plotkind); by calling this method with arguments plot or splot it is possible to choose whether gnuplot can use the splot function.
- Added some options for the splot call (lines, pm3d).
- Modified the kind of temporary files containing the executed script. Now their extension is .p; in this way the scripts can be executed also from within gnuplot.
- Added method clearPlotDirectory to delete all temporary files.
- Changed the pause command for the only splot case. I want to add the plots to a software which has to run after the plot had been shown. The pause -1 blocked it (no way to continue by means of the return command too); now I put pause mouse which let the plot be shown in X11 until the user clicks on it.
The splot had not been tested in case of Graph utilization: if I take on some wotk about it, I'll update this piece of work.
Example Call:
/**
* @param theDataFileName
* @param theTitle
*/
private void gnuSPlotCall(String theDataFileName, String theTitle) {
Plot.setGnuplotExecutable("gnuplot");
Plot.setPlotDirectory(Utils.setPath() + TextWriter.PLOTFOLDER);
Plot aPlot = new Plot();
aPlot.clear();
aPlot.setDataFileName(theDataFileName);
aPlot.setTitle(theTitle);
aPlot.setWithLines(true);
aPlot.setPm3d(true);
aPlot.setOutput(Terminal.PNG, theDataFileName.replace(".dat", ".png"));
try {
aPlot.newPlot(Plots.splot);
System.out.println("####Done");
} catch (Exception e) {
System.err.println(e);
System.exit(1);
}
}
The Plot Class modified as explained in the previous description