我已经浏览了一些问题,但仍然无法解决这个问题。
我的数据集是这样的:
[date] , [%cpu] , [mem]
23:00:39 , 21.9 , 2.1
23:00:44 , 21.8 , 2.1
23:00:49 , 21.8 , 2.1
23:00:54 , 21.8 , 2.1
23:00:59 , 21.7 , 2.1
我的Gnuplot语句(刚开始用于此数据)是:
set timefmt "%H:%m:%s"
set xdata time
set datafile sep ','
plot '/tmp/info' using 2 title 'cpu' with lines, '/tmp/info' using 3 title 'memory%' with lines
我收到以下错误:
Need full using spec for x time data
我已经尝试过自动缩放x,但是我有点迷失了,任何帮助将不胜感激。
时间数据要求您始终指定要使用的所有列。(请注意更正后的内容timefmt
):
set timefmt "%H:%M:%S"
set xdata time
set datafile sep ','
set style data lines
plot '/tmp/info' using 1:2 title 'cpu', '' using 1:3 title 'memory%'
这样做的原因是,timefmt
可能还包含空格,因此用于时间轴的数据可能来自两列。考虑以下修改后的数据文件:
23:00:39 06/08/13 21.9 2.1
23:00:44 06/08/13 21.8 2.1
23:00:49 06/08/13 21.8 2.1
23:00:54 06/08/13 21.8 2.1
23:00:59 06/08/13 21.7 2.1
此格式的绘图命令为:
set timefmt "%H:%M:%S %d/%m/%Y"
set xdata time
set format x "%H:%M:%S"
set style data lines
plot 'mydata.dat' using 1:3 t 'cpu', '' using 1:4 t 'memory%'
为避免混淆,对于时间数据,始终要求with lines
使用以下using
语句明确给出绘图样式(在此处)使用的所有列。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句