【发布时间】:2014-10-16 09:34:03
【问题描述】:
我有来自监控的 CPU 利用率数据。监控不会在分钟的第一秒开始,但 Gnuplot 在这一分钟开始时开始 X 轴的值。缺失的秒数充满了空白(数据图之前和之后)。
是否能够以我的数据开始 X 轴并且没有间隙?
我不能使用:set xrange [ "13:12:24.8" : "13:21:24.8" ] 与监控时间范围的第一个和最后一个值。因为我一天要监控很多次。我希望每 1 或 2 分钟在图表中显示一次网格。
我的数据:
column 1 ... col 195
13:12:24.8 0.78061899
13:12:25.8 5.969546498
13:12:26.8 17.21257881
...
13:21:24.8 6.922475345
gnuplot 脚本:
!/usr/bin/gnuplot
set terminal png size 1280,800
set output "CPU.png"
set title "CPU"
set xlabel "time"
set ylabel "%"
set xdata time
set timefmt "%H:%M:%S"
set format x "%H:%M:%S"
set format y "%10.0f"
set yrange [ 1 : 100 ]
set grid
#source file and collumns for axes x,y
#CPU collumns: User Time: 196 ; Proccessor Time: 195
plot "perfmon.txt" using 1:196 title "User Time" with lines, \
"perfmon.txt" using 1:195 title "Processor Time" with lines
显示差距的图表:
【问题讨论】: