如何在 gnuplot 中格式化 Boxerrorbars

How to format Boxerrorbars in gnuplot

我试图在 gnuplot 中创建一个使用 Boxerrorbars 的图表,但我只得到线条而不是方框。我怎样才能正确格式化它以获得纯色框(带有错误线)? 我的脚本:

#!/usr/bin/gnuplot -persist

reset session
set colorsequence classic

$Data <<EOD
#srvr   pad type    o/s h/s m/s ltnc    kb/s
0   0   Sets    9460.76 --- --- 0.10300 955.14  
1   0   Sets    6372.56 --- --- 0.14800 643.36  
2   0   Sets    6803.38 --- --- 0.13800 686.85  
0   0   Sets    8232.04 --- --- 0.11600 2382.64 
1   0   Sets    6239.53 --- --- 0.14700 1805.93 
2   0   Sets    6607.20 --- --- 0.14300 1912.35 
0   0   Sets    8620.21 --- --- 0.11000 4650.04 
1   0   Sets    6273.20 --- --- 0.14900 3383.98 
2   0   Sets    6338.06 --- --- 0.14900 3418.97 
0   0   Sets    8563.95 --- --- 0.10800 8910.03 
1   0   Sets    6018.97 --- --- 0.15900 6262.21 
2   0   Sets    6660.93 --- --- 0.13900 6930.11 
0   0   Sets    8420.58 --- --- 0.11200 850.12  
1   0   Sets    6277.14 --- --- 0.14900 633.73  
2   0   Sets    7256.48 --- --- 0.13100 732.60  
0   0   Sets    8144.12 --- --- 0.11600 2357.19 
1   0   Sets    6146.69 --- --- 0.15300 1779.06 
2   0   Sets    6689.36 --- --- 0.14100 1936.13 
0   0   Sets    8326.71 --- --- 0.11600 4491.72 
1   0   Sets    6129.93 --- --- 0.15400 3306.69 
2   0   Sets    6617.88 --- --- 0.14200 3569.91 
0   0   Sets    8018.55 --- --- 0.12200 8342.59 
1   0   Sets    6340.77 --- --- 0.14800 6597.01 
2   0   Sets    5800.46 --- --- 0.16600 6034.86 
0   0   Sets    9517.29 --- --- 0.09900 960.85  
1   0   Sets    6418.94 --- --- 0.14500 648.04  
2   0   Sets    6264.59 --- --- 0.14900 632.46  
0   0   Sets    8658.58 --- --- 0.10900 2506.09 
1   0   Sets    6103.07 --- --- 0.15700 1766.44 
2   0   Sets    7106.86 --- --- 0.13100 2056.97 
0   0   Sets    8818.82 --- --- 0.10900 4757.17 
1   0   Sets    6125.73 --- --- 0.15400 3304.43 
2   0   Sets    6915.42 --- --- 0.13600 3730.42 
0   0   Sets    9063.55 --- --- 0.10500 9429.82 
1   0   Sets    6089.46 --- --- 0.15600 6335.54 
2   0   Sets    6701.47 --- --- 0.13800 6972.29 
EOD

ColG = 1
ColF = 2
ColS = 4

set table $Group 
    plot $Data u (column(ColG)) smooth freq
unset table
print $Group

set table $Filter
    plot $Data u (column(ColF)) smooth freq
unset table
print $Filter

set table $Dummy
    array Group[|$Group|-6]         # gnuplot creates 6 extra lines
    array Filter[|$Filter|-6]
    plot $Group u (Group[[=10=]+1]=) w table
    plot $Filter u (Filter[[=10=]+1]=) w table
unset table

print Group
print Filter

Check(i,j) = Group[i]==column(ColG) && Filter[j]==column(ColF) ? column(ColS) : NaN
set print $Data3
    do for [i=1:|Group|] {
        do for [j=1:|Filter|] {
            undef var STATS*
            stats $Data u (Check(i,j)) nooutput
            if (exists('STATS_mean') && exists('STATS_stddev')) {
                print Group[i], Filter[j], STATS_mean, STATS_stddev
            }
        }
        print ""; print ""
    }  
set print
print $Data3

set output 'server_set_throughput.png'
set terminal png size 1000,800
set xtics ("Server 1" 1, "Server 2" 2, "Server 3" 3)
set xrange[0:4]
set yrange[0:10000]
set ylabel "Average Throughput for SET (Operations/Second)" font ",12"
set title "Server's SET Throughput" font "Helvetica,16"
set tics nomirror
set style line 12 lc rgb '#808080' lt 0 lw 1
set grid back ls 12
unset key

plot for [i=0:|Group|-1] $Data3 u (+1):3:4 index i w boxerrorbars

和输出:

两件事:

1) 框的宽度由 "set boxwidth" 控制,除非您提供包含宽度的第 4 列数据。我在你的脚本中没有看到任何这样的命令,但从输出来看,宽度似乎以某种方式设置为 0 或接近于零。添加显式命令 set boxwidth 0.5

2) 填充样式默认为empty。如果您想要实心框,请使用

  set style fill solid border

如果 "border" 关键字没有后续的线条属性集,误差线将使用与框本身相同的颜色和线条类型。如果要突出显示错误栏,请使用类似

set style fill solid border linecolor "black"