I'm trying to display a spectogram using JavaPlot with this piece of code:
PlotStyle style = new PlotStyle();
style.setStyle(Style.IMAGE);
DataSetPlot data = new DataSetPlot(points);
data.setPlotStyle(style);
JavaPlot plot = new JavaPlot();
plot.addPlot(data);
plot.plot();
Where the points are valid as they work when using gnuplot in the command line like this:
gnuplot --persist -e 'plot "data.dat" w image'
The problem is that the above piece of code doesn't show any image at all, it is all white. However the previous command works fine, and data.dat contains the points in the exactly same format. No error appears when running the code.
Here is a example of some points data:
0.0 193.0 0.18183826861232413
0.0 194.0 0.2467637036800797
0.0 195.0 0.43531750893288235
0.0 196.0 0.3893599780473012
0.0 197.0 0.3220816458659573
0.0 198.0 0.25389713892289173
0.0 199.0 0.22935136709597423
1.0 0.0 0.23021155472288352
1.0 1.0 0.33383157107150707
1.0 2.0 0.3745792715533692
1.0 3.0 2.028348052193793
1.0 4.0 2.4150235476868978
1.0 5.0 2.4169194327766736
1.0 6.0 1.8633442057577019
1.0 7.0 4.2682342944471054
1.0 8.0 3.22544345282322
And this are the commands sended to gnuplot by JavaPlot:
set multiplot layout 1,2 rowsfirst downwards
_gnuplot_error = 1
plot '-' title 'Datafile 1' with image ; _gnuplot_error = 0
0.0 9.0 6.612583996900796
1.0 9.0 4.719585678813712
2.0 9.0 0.5475948495661151
3.0 9.0 0.7385211622757041
4.0 9.0 0.711512824841686
5.0 9.0 3.7572382303712604
6.0 9.0 1.0818137070547578
7.0 9.0 0.057188125070687344
8.0 9.0 0.8218555010675036
9.0 9.0 5.754170136586405
e
if (_gnuplot_error == 1) print '_ERROR_'
unset multiplot
quit
For this example I took 10x10 points, so the passed coordinates should be something like:
0.0 0.0 6.612583996900796
0.0 1.0 4.719585678813712
0.0 2.0 0.5475948495661151
0.0 3.0 0.7385211622757041
0.0 4.0 0.711512824841686
0.0 5.0 3.7572382303712604
0.0 6.0 1.0818137070547578
0.0 7.0 0.057188125070687344
0.0 8.0 0.8218555010675036
0.0 9.0 5.754170136586405
1.0 0.0 6.612583996900796
1.0 1.0 4.719585678813712
1.0 2.0 0.5475948495661151
1.0 3.0 0.7385211622757041
1.0 4.0 0.711512824841686
1.0 5.0 3.7572382303712604
1.0 6.0 1.0818137070547578
1.0 7.0 0.057188125070687344
1.0 8.0 0.8218555010675036
1.0 9.0 5.754170136586405
...
9.0 9.0 xxxxxxxxxxxxx
It seems that JavaPlot is not iterating the Y coordinates.
Does someone know what am I doing wrong?
gnuplot.exe, send it to another program which reads from stdin and writes a temporary file...