多图垂直堆叠在一起,在 gnuplot 中具有相同的 x 轴

AK0*_*K02 6 plot graph gnuplot

以下是我使用的代码,下面是我的输出。我想删除子图和 x 标签之间的所有空格。最后的链接中提供了我需要的样本,唯一的区别是我需要所有盒子的大小相同。

set terminal jpeg

set output "mul.jpeg"

set multiplot

set xr[0:10]
set ylabel "y"
set format y ""
set key off

set size 1,0.25

set origin 0.0,0.0;
set xlabel "x"
plot sin(x)
replot sin(2*x)

set origin 0.0,0.25;
set format x ""
plot cos(x)
replot cos(2*x)

set origin 0.0,0.50;
set format x ""
plot sin(x)

set origin 0.0,0.75;
set format x ""
plot cos(x)

unset multiplot
Run Code Online (Sandbox Code Playgroud)

multiplot_example

我真正需要的是这样的:

https://inspirehep.net/record/1345236/files/hada_fig2.png

感谢您的任何帮助!

Joc*_*oce 5

从 gnuplot 5.0 开始,您可以使用 @Raphael_Roth 提供的设置margins为零的解决方案,但也应该使用 ,margins选项multiplot,以便在底部为 tic 标签和 xlabel 留出空间。

例如,

set tmargin 0
set bmargin 0
set lmargin 1
set rmargin 1

set multiplot layout 4,1 margins 0.05,0.95,.1,.99 spacing 0,0

set xrange [0:10]
unset xtics
plot sin(x), sin(2*x)
plot cos(x), cos(2*x)
plot sin(x)

set xtics
plot cos(x)

unset multiplot
Run Code Online (Sandbox Code Playgroud)


Rap*_*oth 2

一种方法是使用multiplot layout,但要使标签和抽动变得更好很麻烦(因为它们重叠或不适合画布)

set terminal jpeg

set output "mul.jpeg"

set tmargin 0
set bmargin 0
set lmargin 1
set rmargin 1

unset xtics
unset ytics
set multiplot layout 4,1

set xr[0:10]
plot sin(x), sin(2*x)
plot cos(x), cos(2*x)
plot sin(x)
plot cos(x)

unset multiplot
Run Code Online (Sandbox Code Playgroud)

另一种可能性是单独设置每个图的边距和/或原点,如这些 SO 答案中所述:multiplot - stacking 3 graphs on a Large canvasHow do gnuplot margins work in multiplot mode?