我想从我的数据集中绘制某些数据,如下所示:
29/11/2014;23:52;983,0;67,8;1016,0;53,0;53,0;29,7
29/11/2014;23:53;269,0;67,8;1018,0;53,0;53,0;29,7
29/11/2014;23:54;266,0;67,8;1008,0;53,0;53,0;29,7
29/11/2014;23:55;59,0;67,8;1011,0;53,0;53,0;29,7
29/11/2014;23:56;37,0;67,8;1016,0;53,0;53,0;29,7
29/11/2014;23:57;457,0;67,8;1000,0;51,9;53,0;29,6
29/11/2014;23:58;570,0;67,8;1000,0;53,0;53,0;29,6
29/11/2014;23:59;1140,0;67,8;1001,0;53,0;52,5;29,6
30/11/2014;00:00;1040,0;67,8;1005,0;52,5;53,0;29,6
30/11/2014;00:01;443,0;67,8;1000,0;53,0;53,0;29,6
30/11/2014;00:02;229,0;67,8;1008,0;52,5;53,0;29,6
30/11/2014;00:03;1035,0;67,8;1001,0;53,0;52,5;29,5
30/11/2014;00:04;681,0;67,8;1000,0;51,9;51,9;29,5
30/11/2014;00:05;931,0;67,8;1008,0;52,5;53,0;29,5
30/11/2014;00:06;889,0;67,8;1010,0;53,0;51,9;29,5
30/11/2014;00:07;885,0;67,8;1000,0;51,9;51,9;29,4
字段分隔符是分号,小数分隔符是逗号,字段日期和时间被认为是彼此独立的(它们由; 符号分隔)
这个数据集涵盖整个月,但我只需绘制与今天对应的数据,由于某种原因,plot命令总是忽略数据,所以我怀疑命令:
"plot file1 using (stringcolumn(1) == date1 ? $2:1/0):6 title " GPU" with lines, "
格式不正确,但在阅读了很多网络相关文章后,我无法猜出如何。
该行" file1 using 2:7 title " CPU" with lines"
中的其余绘图命令按预期工作。
答案 0 :(得分:1)
在using
语句中评估表达式时,必须使用timecolumn
才能获得正确的时间数据。此外,对于字符串比较,请使用eq
运算符:
set xdata time
set timefmt '%H:%M'
set datafile separator ';'
set decimalsign locale
date1='30/11/2014'
plot 'test.dat' using (strcol(1) == date1 ? timecolumn(2) : 1/0):6 with lines title "GPU"