Gnuplot 聚类直方图边界

Gnuplot clustered histograms borders

我有一个聚类直方图,如下所示:

我想要的是某种边界(像 xgrid 但在集群之间,而不是在集群中间)。

我怎样才能做到这一点?

我的直方图是用这个构建的:

set encoding iso_8859_1
set terminal postscript enhanced color
set grid ytics
set style data histogram
set style histogram cluster gap 2
set style fill solid border rgb "black"
set auto x
set xtics rotate by -45
set xrange [0:10]
plot 'data.gnu' using 2:xtic(1), \
        '' using 3:xtic(1), \
        '' using 4:xtic(1), \
        '' using 5:xtic(1), \
        '' using 6:xtic(1)

我希望你能用 mxtics 做点什么,但我没有成功。那么,可能最简单的方法就是手动绘制线条。请注意,如果每组有 5 个柱(或奇数),则 xtic 不会居中于直方图。相应地移动边框。

代码:

### (manual) borders between clustered histogram
reset session

$Data <<EOD
One   -1 -2 3 4 5
Two   -2 -3 4 5 6
Three -3 -4 5 6 7
Four  -4 -5 6 7 8
EOD

set grid ytics
set style data histogram
set style histogram cluster gap 2
set style fill solid border rgb "black"
set xtics rotate by -45
set xrange [-0.5:3.7]
set xtics
unset key

do for [i=1:3] {
    set arrow i from i-0.4, graph 0 to i-0.4, graph 1 nohead
}

plot $Data using 2:xtic(1), \
        '' using 3:xtic(1), \
        '' using 4:xtic(1), \
        '' using 5:xtic(1), \
        '' using 6:xtic(1)
### end of code

结果: