pab*_*cin 2 plot gnuplot time-series
我正在打印具有以下格式的时间序列
> 1400536853 0.011955
> 1400537188 0.013695
> 1400537530 0.010797
> ....
> 1400621709 0.010688
> 1400622023 0.007209
> 1400622338 0.006685
> 1400622653 0.005539
Run Code Online (Sandbox Code Playgroud)
第一列是unix epoch格式的时间戳,第二列是要绘制的变量.请注意,第一行的时间戳对应于"Tue May 20 00:00:53 CEST 2014",最后一行对应于"Tue May 20 23:50:53 CEST 2014".我使用以下命令验证了这一点:
date -d @<timestamp>
Run Code Online (Sandbox Code Playgroud)
我正在使用以下脚本来绘制时间序列
set xdata time
set timefmt '%s'
set format x '%H'
plot 'series.txt' using 1:2 with lines notitle
Run Code Online (Sandbox Code Playgroud)
但是我得到了一个小时数在22,00,02 ...... 22之间的情节,如下图所示:
我将不胜感激任何关于如何解决这个问题的建议.这可能与未正确设置时区有关吗?提前谢谢了
Gnuplot无法更改时区并将UTC用于所有时间数据.这是您的2小时轮班来自:
$ date -u -d @1400536853
Mo 19. Mai 22:00:53 UTC 2014
Run Code Online (Sandbox Code Playgroud)
在您的具体情况下,您可以在using
声明中添加两个小时:
set xdata time
set timefmt '%s'
set format x '%H'
plot 'series.txt' using ($1 + 2*60*60):2 with lines notitle
Run Code Online (Sandbox Code Playgroud)
请注意,这明确假设您只在同一时区的计算机上运行脚本.我认为在gnuplot中没有通用的方法来转换时区,因为它不支持它们.