gnuplot行堆叠直方图-don';不显示每个xtic

gnuplot行堆叠直方图-don';不显示每个xtic,gnuplot,histogram,Gnuplot,Histogram,我有一个包含很多行的数据文件-它是CPU使用率(分解为%user、%system、%iowait和%nice),在24小时内每5秒采样一次,因此17280个样本全部收集起来。我的输入文件如下所示: Time CPU %user %nice %system %iowait %steal %idle 17:11:05 all 4.46 0.00 0.57 0.79 0.

我有一个包含很多行的数据文件-它是CPU使用率(分解为%user、%system、%iowait和%nice),在24小时内每5秒采样一次,因此17280个样本全部收集起来。我的输入文件如下所示:

Time              CPU     %user     %nice   %system   %iowait    %steal     %idle
17:11:05          all      4.46      0.00      0.57      0.79      0.00     94.18
17:11:10          all      2.34      0.00      0.31      0.44      0.00     96.91
17:11:15          all      2.48      0.00      0.33      0.14      0.00     97.06
set key autotitle columnhead
set style data histogram
set style histogram rowstacked
set style fill solid border -1
set boxwidth 1.0
plot 'sarout.csv' using "%user":xtic(1), '' using "%system", '' using "%iowait", '' using "%nice"
为了尝试查看何时出现高CPU负载,我想将一段时间内的非空闲CPU使用情况绘制为柱状图,我使用如下方法:

Time              CPU     %user     %nice   %system   %iowait    %steal     %idle
17:11:05          all      4.46      0.00      0.57      0.79      0.00     94.18
17:11:10          all      2.34      0.00      0.31      0.44      0.00     96.91
17:11:15          all      2.48      0.00      0.33      0.14      0.00     97.06
set key autotitle columnhead
set style data histogram
set style histogram rowstacked
set style fill solid border -1
set boxwidth 1.0
plot 'sarout.csv' using "%user":xtic(1), '' using "%system", '' using "%iowait", '' using "%nice"
问题是,这给了我一个每一列的xtic(即时间),这是不可读的


有没有办法让xtic只在小时内出现?i、 e.当时间字符串匹配“*:00:00”时,

Gnuplot直方图没有常规的数值轴。您可以在
xtic
中设置条件,但这只影响tic标签,而不影响tic

要获得一个正常的数值轴,您必须用方框绘制
,但这不允许您叠加值。或者使用BoxyErrorBars打印和堆叠

set key autotitle columnhead
set style fill solid border -1
set xdata time
set timefmt '%H:%M:%S'
set format x '%H'
set xtics 360

plot 'sarout.csv' using 1:(0.5*column("%user")):(60):"%user" with boxxyerrorbars, \
        '' using 1:(column("%user")+0.5*column("%system")):(60):"%system" with boxxyerrorbars,\
        '' using 1:(column("%user")+column("%system")+0.5*column("%iowait")):(60):"%iowait" with boxxyerrorbars, \
        '' using 1:(column("%user")+column("%system")+column("%iowait")+0.5*column("%nice")):(60):"%nice" with boxxyerrorbars
这写起来相当冗长,但是可以让您最好地控制tics。我目前无法测试这段代码,但它应该可以工作