x范围无效。也许timefmt错了

时间:2017-09-01 14:23:42

标签: gnuplot

我有以下脚本

set datafile separator ","
set grid

set autoscale

set timefmt "%y-%m-%d %H:%M:%S"
set xdata time

plot 'test.txt' using 1:2 with lines

数据

2017-09-01 13:15:29,615,668
2017-09-01 13:15:29,615,666 
2017-09-01 13:15:29,614,666
2017-09-01 13:15:29,615,666
2017-09-01 13:15:29,615,665
2017-09-01 13:19:52,614,660
2017-09-01 13:19:52,615,661

我想绘制由postgresql生成的这些数据。从几小时后我就无法弄清楚为什么我会

gnuplot> plot 'test.txt' using 1:2 with lines
                                             ^
         "strom-plot.txt", line 9: x range is invalid

任何暗示都会受到赞赏。

编辑:我在gnuplot 5.0 patchlevel 5 debian stretch

1 个答案:

答案 0 :(得分:2)

问题是timefmt参数中的错误。您应该使用%Y而不是%y。来自help timefmt

Format       Explanation
%y           year, 0--99
%Y           year, 4-digit

这可以在这里工作:

set datafile separator ","
set grid

set autoscale

set timefmt "%Y-%m-%d %H:%M:%S"
set xdata time

plot 'test.txt' using 1:2 with lines

结果:

Plot of first and second columns

相关问题