在时间数据前后绘制时间数据 [英] Plot time data without gaps before and after data

查看:83
本文介绍了在时间数据前后绘制时间数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有来自监视的CPU使用率数据.监视不是在分钟的第一秒开始,而是Gnuplot在此分钟的开始开始X轴的值.缺少的秒数充满了空白(数据图表前后).

I have data of CPU utilization from monitoring. Monitoring does not start at first second of minute, but Gnuplot starts vaules of X axis at beginning of this minute. And missing seconds are filled with gaps (before and after graph of data).

是否可以用我的数据开始X轴并且没有间隙?

Is it able to start axis X with my data and no gap?

我不能使用:set xrange [ "13:12:24.8" : "13:21:24.8" ]带有监视时间范围的第一个和最后一个值.因为我一天要监视很多次.而且我希望每1或2分钟在图表中生成一个网格.

I can not use: set xrange [ "13:12:24.8" : "13:21:24.8" ] with first and last value of monitored range of time. Because I monitor it many times a day. And I want grid in graph every 1 or 2 minutes.

我的数据:

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

显示差距的图形:

推荐答案

这些间隙"是由gnuplot的默认行为所引起的,该行为将轴范围扩展到下一个全刻度.为避免在X轴上出现此问题,请使用

These "gaps" are caused by gnuplot's default behavior to extend axis ranges to the next full tic. To avoid this for the x-axis, use

set autoscale xfix

这篇关于在时间数据前后绘制时间数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆