我想在y轴上绘制数据,在x轴上绘制日期,我将它全部放在列中。我有格式
的数据2016.0000000000000 10.000000000000000 14.000000000000000 117.62999700000000
2016.0000000000000 10.000000000000000 13.000000000000000 116.98000300000000
2016.0000000000000 10.000000000000000 12.000000000000000 117.33999600000000
2016.0000000000000 10.000000000000000 11.000000000000000 116.30000300000000
2016.0000000000000 10.000000000000000 10.000000000000000 116.05000300000000
2016.0000000000000 10.000000000000000 7.0000000000000000 114.05999799999999
2016.0000000000000 10.000000000000000 6.0000000000000000 113.88999900000000
在文件中,其中结构为年,月,日,数据,标签为分隔符。我尝试过的代码是:
set xdata time
set timefmt "\"%Y\t%m\t%d\""
set xrange ['"2016\t10\t14"':'"2006\t10\t16"']
plot "data.txt" u 1:2
但显然这并不是将日期视为x
值,将数据视为y
值,因为运行时出现此错误消息:
line 5: warning: Skipping data file with no valid points
line 5: Can't plot with an empty x range!
第5行指的是包含plot命令的行。我如何告诉程序我想绘制的是数据与日期?
答案 0 :(得分:0)
set xdata time
set timefmt "%Y %m %d"
set xrange ["2016 10 06":"2006 10 16"]
plot "data.txt" u (sprintf("%d %d %d",$1,$2,$3)):4