1

我一直在制作一堆堆积的直方图,如本页底部附近所示。

我能够调整我的情节,使其看起来像我想要的那样,但我正在努力解决关键问题。它很大,所以我想把它放在情节下方。

明智的做法似乎是set key outside below center

但是,看起来 gnuplot 实际上是使键的第二列居中,而不是使整个键居中。

当前的 gnuplot 结果

我的问题:我该如何解决这个问题?

这是我的完整 gnuplot 代码:

set terminal postscript enh color eps font ",18"
set output "SO.eps"

set style data histogram
set style histogram rowstacked
set style fill solid border 0
set boxwidth 0.9
set tmargin 2
set bmargin 10
set key outside below center vertical maxrows 4 width -5


set yrange [0:600]
set y2range [0:100]

set xlabel "Number of compute nodes"
set ylabel "Computation Time (s)"
set y2label "Efficiency (%)"
set ytics nomirror
set xtics nomirror
set y2tics 20

plot newhistogram lt 1 , \
"SO.dat" index 0 u 2:xtic(1) title "Warm-Up", \
"" index 0 u 3 title "First program configuration", \
"" index 0 u 4:xtic(1) title "Second configuration", \
"" index 0 u 5 title "Target", \
newhistogram lt 1 , \
"SO.dat" index 1 u 2 notitle, \
"" index 1 u 3 notitle, \
"" index 1 u 4:xtic(1) notitle, \
"" index 1 u 5 notitle, \
newhistogram lt 1 , \
"SO.dat" index 2 u 2 notitle, \
"" index 2 u 3 notitle, \
"" index 2 u 4:xtic(1) notitle, \
"" index 2 u 5 notitle, \
newhistogram lt 1 , \
"SO.dat" index 3 u 2 notitle, \
"" index 3 u 3 notitle, \
"" index 3 u 4:xtic(1) notitle, \
"" index 3 u 5 notitle, \
"SO.dat" index 4 u 1:2 title "First program efficiency" with linespoints axes x1y2, \
"" index 4 u 1:3 title "Second program efficiency" with linespoints axes x1y2, \
"" index 4 u 1:4 title "Target efficiency" with linespoints axes x1y2
4

1 回答 1

0

稍微修改一下我的脚本终于给了我想要的结果。

问题来自此命令:

在中心垂直maxrows 4宽度-5`下方设置键

相当于写:

set key outside below
set key vertical maxrows 4 width -5

这不同于:

set key vertical maxrows 4 width -5
set key outside below

顺序很重要。在第一个(错误的)命令中,键首先以其(默认)单列格式放置在图形下方,然后其布局更改为两列。但它原来的 x,y 位置保持不变。

在给出所需结果的第二个命令中,首先确定“双列”键布局。然后将键设置在具有更新宽度的图形下方并适当居中。

最终绘图结果

于 2019-09-17T01:14:15.160 回答