-1

我有一个像

1429520881 15.0
1429520882 3.0
1429520883 340.0

我尝试在 JavaPlot 中使用它

JavaPlot plot=new JavaPlot();
GenericDataSet dataset=new GenericDataSet();
filling dataset with data
...
plot.set("xdata","time");
plot.set("timefmt","'%s'");
plot.set("format x","'%H:%M:%S'");
plot.plot();

结果 gnuplot 的窗口没有出现,但如果我直接在 gnuplot 中使用相同的数据和选项尝试此文件,它会显示我在 xAxis 上的时间;如果在 JavaPlot 中我删除了最后一个设置(xdata、timefmt、格式),它可以工作,但它只显示数字

我还尝试使用程序中的数据创建手动数据集,但结果相同。

我也用日期作为字符串实现了新的数据集,但似乎 xdata,time 选项不起作用

4

2 回答 2

1

花了很长时间才弄清楚这一点。我发现如果你有一个 DataSetPlot 对象,你可以设置“使用”选项:

DataSetPlot dataSet = new DataSetPlot( values );
dataSet.set( "using", "1:2" );

这将使用 plot 命令的 'using' 选项,例如:

plot '-' using 1:2 title 'Success' with lines linetype rgb 'green'

在 x 轴上使用时间时,您必须具有“使用”选项,否则您将看到此错误:

需要完整使用 x 时间数据的规范

于 2016-01-19T10:48:56.843 回答
0

由于ParametersHolder继承了HashMap,并且在'-'之后应该有“using”关键字,它会以奇怪的顺序生成带有数据的临时脚本文件,例如:

set ... ...(xrange,yrange etc)
set xdata time
set timefmt '%s'
set format x '%H:%M:%S'
plot '-' using 1:2 title 'ololo' with linesploints lineType 2 lineWidth 3
1429520881 15.0
1429520882 3.0
1429520883 340.0
e
quit

但它是

set xdata time
set ... ...(xrange,yrange etc)
set format x '%H:%M:%S'
set timefmt '%s'
plot '-' title 'ololo' with linesploints lineType 2 lineWidth 3
1429520881 15.0
1429520882 3.0
1429520883 340.0
e
quit
于 2015-04-30T10:45:15.243 回答