GNUplot 堆叠多图 - 顶部图未完全对齐

GNUplot stacked multiplot - Top plot does not align perfectly

我正在尝试使用 GNUplot 制作堆叠图。

TMARGIN = 0.05
BMARGIN = 0.15
LMARGIN = 0.15
RMARGIN = 0.0

TCOORD=1-TMARGIN
BCOORD=1-BMARGIN

DY = 0.2

# Ratio
set size ratio 0.5

# Tics
unset xtics
unset ytics

# Multiplot
set multiplot layout 4, 1
unset key
unset title

# Global
set lmargin at screen LMARGIN
set rmargin at screen RMARGIN

# Plot 0
set tmargin at screen TCOORD; set bmargin at screen TCOORD-DY;
plot sin(x)

# Plot 1
set tmargin at screen TCOORD-DY; set bmargin at screen TCOORD-(2*DY)
plot sin(x)

# Plot 2
set tmargin at screen TCOORD-(2*DY); set bmargin at screen TCOORD-(3*DY)
plot sin(x)

# Plot 3
set tmargin at screen TCOORD-(3*DY); set bmargin at screen TCOORD-(4*DY)
set xlabel "xlabel"
plot sin(x)

使用上面的脚本,我最终得到的顶部图与其他图不对齐。

没主意了。 感谢您的帮助。

提前致谢!

编辑:如果相关,这是 Archlinux 上的“版本 5.4 补丁级别 2”。

您的脚本尝试使用三种不同的方法来调整绘图位置:set ratioset multiplot layoutset margin。他们在互相争斗。如果我理解正确的话,这一切都可以在 multiplot layout 命令中完成。如果 2:1 比例很重要,您可能需要手动计算右边距 and/or 使用 set termsize 参数调整输出宽度。

# No extra stuff around the edges
unset xtics
unset ytics
unset key
unset title

# Multiplot
set multiplot layout 4, 1 margins screen 0.15, 1.0, 0.1, 1.0 spacing 0,0

# Plot 0
plot sin(x)

# Plot 1
plot sin(x)

# Plot 2
plot sin(x)

# Plot 3
set xlabel "xlabel"
plot sin(x)

unset multi