我想用x数据作为时间值绘制数据。 csv文件如下所示
"","12/09/29","00:19:43"," 1787"," 12","12"
"","12/09/29","00:19:48"," 1787"," 12","12"
"","12/09/29","00:19:53"," 1785"," 13","12"
"","12/09/29","00:19:58"," 1785"," 12","12"
这里的问题是双引号的用法。我试过这个
set timefmt '"%y/%m/%d","%H:%M:%S"'
set datafile separator ","
plot 'myFile.csv' using 2:3:4 with lines
但它无法识别时间格式。
如何通过双引号和逗号分隔符识别两个分隔列的时间值?
感谢您的帮助。
托马斯
答案 0 :(得分:2)
如果引用是问题,并且您在启用了管道的posix系统上,则可以轻松删除它们:
plot '< sed -e s/\"//g test.dat' using 2:4:5
请注意,using
规范也已更改(2:4:5
而非2:3:4
),因为您的时间格式需要 2列。
请注意,我认为报价不存在问题:
set datafile sep ','
set xdata time
set timefmt '%y/%m/%d,%H:%M:%S' #no quotes in timefmt -- Gnuplot removes them when parsing the datafile.
plot 'test.dat' using 2:4:5 with lines
适合我。
所以我真的认为问题是你的使用规范指向第三列(包含时间信息)而不是第四列。最后,您可以使用using 2:4
创建相同的图表 - 您实际上从未在第5列中使用第5列。