日期模数周时间轴

时间:2014-12-21 06:24:25

标签: date time gnuplot cycle

我的时间序列数据如下所示:

20140630 22:40:00 25.5
20140630 22:45:00 25.54

20140630 23:00:00 25.54
20140630 23:05:00 25.6

20140630 23:50:00 25.28
20140630 23:55:00 25.325
20140701 00:00:00 25.34
20140701 00:05:00 25.22
20140701 00:10:00 25.2

20140702 00:25:00 25.1
20140702 00:30:00 25.18
20140702 00:35:00 25.14

20140703 00:40:00 25.14
20140703 00:45:00 25.12
20140703 00:50:00 25.1
多天来。我想以模数周为单位绘制数据,创建类似于以下内容的叠加层(但请注意,我在几秒钟内使用时间并将其模数为60 * 60 * 24 * 7):Date Plot gnuplot无法识别set timefmt中的星期几,否则格式字符串"%a %H:%M"将非常适合我的目的。我的数据是从数据库中提取的,可以进行预处理(目前在Ruby / Rails中)。某些数据点可能会丢失。

1 个答案:

答案 0 :(得分:3)

您可能会受益于函数timecolumn(),它根据设置的timefmt设置从列中解析时间字符串。结果是以秒为单位的时间戳。

我以这种方式使用它:

plot 'file.dat' using (timecolumn(1)/60*60*24*7):2

假设你使用的是:

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

(顺便说一下,我在日期空间有问题,我使用格式"%Y-%m-%dT%H:%M:%S"解决了)