Gnuplot 通过使用multiplot以相同的长度允许每个绘图的X比例以列方式对齐图形
我试图按列顺序绘制五个图(a、b、c、d、e),如下所示 每个图的x标度不同,它们不在垂直线上,但图(c)、(d)和(e)的x范围值几乎相似,即24.8 当我按列顺序绘制这些图时,我发现标记为(a)和(b)的图分别被拉伸和压缩。 然而,标有(c)、(d)和(e)的图具有相同的标度长度 我在垂直方向上画了一条红线,以显示每个图形的x比例是如何对齐的。(请参见附图) 下面给出了我使用的gnuplot脚本Gnuplot 通过使用multiplot以相同的长度允许每个绘图的X比例以列方式对齐图形,gnuplot,Gnuplot,我试图按列顺序绘制五个图(a、b、c、d、e),如下所示 每个图的x标度不同,它们不在垂直线上,但图(c)、(d)和(e)的x范围值几乎相似,即24.8 当我按列顺序绘制这些图时,我发现标记为(a)和(b)的图分别被拉伸和压缩。 然而,标有(c)、(d)和(e)的图具有相同的标度长度 我在垂直方向上画了一条红线,以显示每个图形的x比例是如何对齐的。(请参见附图) 下面给出了我使用的gnuplot脚本 #!/usr/bin/env gnuplot ######################
#!/usr/bin/env gnuplot
#########################################################################################
#OUTPUT
#PNG
set terminal pngcairo size 600,550 enhanced dash #font "Arial-Bold,13" #fontscale 1.20
set output "zMulti-plot-LDP-lyoSystems.png"
#########################################################################################
set style line 1 lt 1 lw 1.5 lc rgb "red"
set style line 2 lt 3 lw 1.5 lc rgb "red"
set style line 3 lt 5 lw 1.5 lc rgb "red"
set style line 4 lt 1 lw 1.5 lc rgb "black"
set style line 5 lt 3 lw 1.5 lc rgb "black"
set style line 6 lt 5 lw 1.5 lc rgb "black"
set style line 7 lt 1 lw 1.5 lc rgb "green"
set style line 8 lt 3 lw 1.5 lc rgb "green"
set style line 9 lt 5 lw 1.5 lc rgb "green"
set style line 10 lt 1 lw 1.5 lc rgb "blue"
set style line 11 lt 3 lw 1.5 lc rgb "blue"
set style line 12 lt 5 lw 1.5 lc rgb "blue"
set style line 13 lt 1 lw 1.5 lc rgb "magenta"
set style line 14 lt 3 lw 1.5 lc rgb "magenta"
set style line 15 lt 5 lw 1.5 lc rgb "magenta"
set style line 16 lt 1 lw 1.5 lc rgb "#6495ED"
set style line 17 lt 3 lw 1.5 lc rgb "#6495ED"
set style line 18 lt 5 lw 1.5 lc rgb "#6495ED"
#########################################################################################
set macro
#ylabelFONT="font 'arial,16'"
labelFONT="font 'Arial,18'"
scaleFONT="font 'Arial-Bold,14'"
keyFONT="font 'Arial,10'"
#graph="using 1:2 with lines lw 1 "
#########################################################################################
xsize = 0.80
ysize = 0.22
xorigin = 0.002
yorigin = 0.02
#####################################################################
set xrange [-24.8:24.8]
set yrange [0:2.5]
set xtic auto @scaleFONT # set xtics automatically
#set ytic 0,0.2,0.4 @scaleFONT # set ytics automatically
set ytic " " #0,0.2,0.4 @scaleFONT # set ytics automatically
unset key
set size 1.0,1.0
set multiplot
# plot A
set ylabel ""
set label "(e)" at 0,0.60 @scaleFONT
set origin xorigin,yorigin
set size xsize,(ysize+0.015)
plot "bcm25perRS-000-050ns_only_HEAD.dat" using 1:2 title '1-050ns' w l ls 1 ,\
"bcm25perRS-000-050ns_only_TAIL.dat" using 1:2 title '1-050ns' w l ls 2 ,\
"bcm25perRS-000-050ns_only_WATER.dat" using 1:2 title '1-050ns' w l ls 3 ,\
"bcm25perRS-051-100ns_only_HEAD.dat" using 1:2 title '51-100ns' w l ls 4 ,\
"bcm25perRS-051-100ns_only_TAIL.dat" using 1:2 title '51-100ns' w l ls 5 ,\
"bcm25perRS-051-100ns_only_WATER.dat" using 1:2 title '51-100ns' w l ls 6 ,\
"bcm25perRS-101-150ns_only_HEAD.dat" using 1:2 title '101-150ns' w l ls 7 ,\
"bcm25perRS-101-150ns_only_TAIL.dat" using 1:2 title '101-150ns' w l ls 8 ,\
"bcm25perRS-101-150ns_only_WATER.dat" using 1:2 title '101-150ns' w l ls 9 ,\
"bcm25perRS-151-200ns_only_HEAD.dat" using 1:2 title '151-200ns' w l ls 10 ,\
"bcm25perRS-151-200ns_only_TAIL.dat" using 1:2 title '151-200ns' w l ls 11 ,\
"bcm25perRS-151-200ns_only_WATER.dat" using 1:2 title '151-200ns' w l ls 12 ,\
"bcm25perRS-201-250ns_only_HEAD.dat" using 1:2 title '201-250ns' w l ls 13 ,\
"bcm25perRS-201-250ns_only_TAIL.dat" using 1:2 title '201-250ns' w l ls 14 ,\
"bcm25perRS-201-250ns_only_WATER.dat" using 1:2 title '201-250ns' w l ls 15 ,\
"bcm25perRS-251-300ns_only_HEAD.dat" using 1:2 title '251-300ns' w l ls 16 ,\
"bcm25perRS-251-300ns_only_TAIL.dat" using 1:2 title '251-300ns' w l ls 17 ,\
"bcm25perRS-251-300ns_only_WATER.dat" using 1:2 title '251-300ns' w l ls 18
# plot B
set xrange [-24.8:24.8]
set ylabel ""
unset label
set label "(d)" at 0,0.60 @scaleFONT
#set format x ""
set origin xorigin,(yorigin+0.19)
set size xsize,ysize+0.02
plot "bcm25perS-000-050ns_only_HEAD.dat" using 1:2 title '1-050ns' w l ls 1 ,\
"bcm25perS-000-050ns_only_TAIL.dat" using 1:2 title '1-050ns' w l ls 2 ,\
"bcm25perS-000-050ns_only_WATER.dat" using 1:2 title '1-050ns' w l ls 3 ,\
"bcm25perS-051-100ns_only_HEAD.dat" using 1:2 title '51-100ns' w l ls 4 ,\
"bcm25perS-051-100ns_only_TAIL.dat" using 1:2 title '51-100ns' w l ls 5 ,\
"bcm25perS-051-100ns_only_WATER.dat" using 1:2 title '51-100ns' w l ls 6 ,\
"bcm25perS-101-150ns_only_HEAD.dat" using 1:2 title '101-150ns' w l ls 7 ,\
"bcm25perS-101-150ns_only_TAIL.dat" using 1:2 title '101-150ns' w l ls 8 ,\
"bcm25perS-101-150ns_only_WATER.dat" using 1:2 title '101-150ns' w l ls 9 ,\
"bcm25perS-151-200ns_only_HEAD.dat" using 1:2 title '151-200ns' w l ls 10 ,\
"bcm25perS-151-200ns_only_TAIL.dat" using 1:2 title '151-200ns' w l ls 11 ,\
"bcm25perS-151-200ns_only_WATER.dat" using 1:2 title '151-200ns' w l ls 12 ,\
"bcm25perS-201-250ns_only_HEAD.dat" using 1:2 title '201-250ns' w l ls 13 ,\
"bcm25perS-201-250ns_only_TAIL.dat" using 1:2 title '201-250ns' w l ls 14 ,\
"bcm25perS-201-250ns_only_WATER.dat" using 1:2 title '201-250ns' w l ls 15 ,\
"bcm25perS-251-300ns_only_HEAD.dat" using 1:2 title '251-300ns' w l ls 16 ,\
"bcm25perS-251-300ns_only_TAIL.dat" using 1:2 title '251-300ns' w l ls 17 ,\
"bcm25perS-251-300ns_only_WATER.dat" using 1:2 title '251-300ns' w l ls 18
# plot C
set xrange [-24.4:24.4]
set ylabel ""
unset label
set label "(c)" at 0,0.60 @scaleFONT
set origin xorigin,(yorigin+0.385)
set size xsize,ysize+0.02
plot "bcm25perR-000-050ns_only_HEAD.dat" using 1:2 title '1-050ns' w l ls 1 ,\
"bcm25perR-000-050ns_only_TAIL.dat" using 1:2 title '1-050ns' w l ls 2 ,\
"bcm25perR-000-050ns_only_WATER.dat" using 1:2 title '1-050ns' w l ls 3 ,\
"bcm25perR-051-100ns_only_HEAD.dat" using 1:2 title '51-100ns' w l ls 4 ,\
"bcm25perR-051-100ns_only_TAIL.dat" using 1:2 title '51-100ns' w l ls 5 ,\
"bcm25perR-051-100ns_only_WATER.dat" using 1:2 title '51-100ns' w l ls 6 ,\
"bcm25perR-101-150ns_only_HEAD.dat" using 1:2 title '101-150ns' w l ls 7 ,\
"bcm25perR-101-150ns_only_TAIL.dat" using 1:2 title '101-150ns' w l ls 8 ,\
"bcm25perR-101-150ns_only_WATER.dat" using 1:2 title '101-150ns' w l ls 9 ,\
"bcm25perR-151-200ns_only_HEAD.dat" using 1:2 title '151-200ns' w l ls 10 ,\
"bcm25perR-151-200ns_only_TAIL.dat" using 1:2 title '151-200ns' w l ls 11 ,\
"bcm25perR-151-200ns_only_WATER.dat" using 1:2 title '151-200ns' w l ls 12 ,\
"bcm25perR-201-250ns_only_HEAD.dat" using 1:2 title '201-250ns' w l ls 13 ,\
"bcm25perR-201-250ns_only_TAIL.dat" using 1:2 title '201-250ns' w l ls 14 ,\
"bcm25perR-201-250ns_only_WATER.dat" using 1:2 title '201-250ns' w l ls 15 ,\
"bcm25perR-251-300ns_only_HEAD.dat" using 1:2 title '251-300ns' w l ls 16 ,\
"bcm25perR-251-300ns_only_TAIL.dat" using 1:2 title '251-300ns' w l ls 17 ,\
"bcm25perR-251-300ns_only_WATER.dat" using 1:2 title '251-300ns' w l ls 18
# plot D
set xrange [-26.2:26.2]
set xtics auto
set ylabel ""
unset label
set label "(b)" at 0,0.60 @scaleFONT
set origin xorigin,(yorigin+0.58)
set size xsize,ysize+0.02
plot "malto23per-000-050ns_only_HEAD.dat" using 1:2 title '1-050ns' w l ls 1 ,\
"malto23per-000-050ns_only_TAIL.dat" using 1:2 title '1-050ns' w l ls 2 ,\
"malto23per-000-050ns_only_WATER.dat" using 1:2 title '1-050ns' w l ls 3 ,\
"malto23per-051-100ns_only_HEAD.dat" using 1:2 title '51-100ns' w l ls 4 ,\
"malto23per-051-100ns_only_TAIL.dat" using 1:2 title '51-100ns' w l ls 5 ,\
"malto23per-051-100ns_only_WATER.dat" using 1:2 title '51-100ns' w l ls 6 ,\
"malto23per-101-150ns_only_HEAD.dat" using 1:2 title '101-150ns' w l ls 7 ,\
"malto23per-101-150ns_only_TAIL.dat" using 1:2 title '101-150ns' w l ls 8 ,\
"malto23per-101-150ns_only_WATER.dat" using 1:2 title '101-150ns' w l ls 9 ,\
"malto23per-151-200ns_only_HEAD.dat" using 1:2 title '151-200ns' w l ls 10 ,\
"malto23per-151-200ns_only_TAIL.dat" using 1:2 title '151-200ns' w l ls 11 ,\
"malto23per-151-200ns_only_WATER.dat" using 1:2 title '151-200ns' w l ls 12 ,\
"malto23per-201-250ns_only_HEAD.dat" using 1:2 title '201-250ns' w l ls 13 ,\
"malto23per-201-250ns_only_TAIL.dat" using 1:2 title '201-250ns' w l ls 14 ,\
"malto23per-201-250ns_only_WATER.dat" using 1:2 title '201-250ns' w l ls 15 ,\
"malto23per-251-300ns_only_HEAD.dat" using 1:2 title '251-300ns' w l ls 16 ,\
"malto23per-251-300ns_only_TAIL.dat" using 1:2 title '251-300ns' w l ls 17 ,\
"malto23per-251-300ns_only_WATER.dat" using 1:2 title '251-300ns' w l ls 18
# plot E
set xrange [-20.0:20.0]
set xtics auto
set ylabel ""
unset label
set label "(a)" at 0,0.60 @scaleFONT
set origin xorigin,(yorigin+0.77)
set size xsize,ysize+0.02
plot "malto12per-000-050ns_only_HEAD.dat" using 1:2 title '1-050ns' w l ls 1 ,\
"malto12per-000-050ns_only_TAIL.dat" using 1:2 title '1-050ns' w l ls 2 ,\
"malto12per-000-050ns_only_WATER.dat" using 1:2 title '1-050ns' w l ls 3 ,\
"malto12per-051-100ns_only_HEAD.dat" using 1:2 title '51-100ns' w l ls 4 ,\
"malto12per-051-100ns_only_TAIL.dat" using 1:2 title '51-100ns' w l ls 5 ,\
"malto12per-051-100ns_only_WATER.dat" using 1:2 title '51-100ns' w l ls 6 ,\
"malto12per-101-150ns_only_HEAD.dat" using 1:2 title '101-150ns' w l ls 7 ,\
"malto12per-101-150ns_only_TAIL.dat" using 1:2 title '101-150ns' w l ls 8 ,\
"malto12per-101-150ns_only_WATER.dat" using 1:2 title '101-150ns' w l ls 9 ,\
"malto12per-151-200ns_only_HEAD.dat" using 1:2 title '151-200ns' w l ls 10 ,\
"malto12per-151-200ns_only_TAIL.dat" using 1:2 title '151-200ns' w l ls 11 ,\
"malto12per-151-200ns_only_WATER.dat" using 1:2 title '151-200ns' w l ls 12 ,\
"malto12per-201-250ns_only_HEAD.dat" using 1:2 title '201-250ns' w l ls 13 ,\
"malto12per-201-250ns_only_TAIL.dat" using 1:2 title '201-250ns' w l ls 14 ,\
"malto12per-201-250ns_only_WATER.dat" using 1:2 title '201-250ns' w l ls 15 ,\
"malto12per-251-300ns_only_HEAD.dat" using 1:2 title '251-300ns' w l ls 16 ,\
"malto12per-251-300ns_only_TAIL.dat" using 1:2 title '251-300ns' w l ls 17 ,\
"malto12per-251-300ns_only_WATER.dat" using 1:2 title '251-300ns' w l ls 18
# plot F
set size 0.3,0.5
set origin 0.76,0.55
set bmargin at screen 0
set key center center
set border 0
unset xlabel
unset ylabel
unset label
unset tics
set format x ""
set format y ""
set yrange [0:1]
plot 2 ls 1 t '1-50ns', \
2 ls 4 t '51-100ns', \
2 ls 7 t '101-150ns', \
2 ls 10 t '151-200ns', \
2 ls 13 t '201-250ns', \
2 ls 16 t '251-300ns'
unset multiplot
有人可以研究一下这个问题,并帮助我得到一个多点,如我所示,但让每个绘图的比例是在垂直顺序对齐
如果图形大小是小的还是大的都可以
但我想让刻度垂直对齐
谢谢你的帮助
多谢各位
如果我编辑将xrange[-26.2:26.2]
设置为所有对象都相同,我会得到下面的内容。。这是我不想要的。我只想看到我在第一张照片中的样子
基本上,您必须调整绘图大小和原点的x值,以便最宽的绘图保持其当前大小,而所有其他绘图则根据其较小的范围进行移动和压缩 由于我没有任何数据文件,也无法测试整个脚本,下面是您需要执行的操作的示意图:
xsize(width) = 0.80 * width / width_max
ysize = 0.22
width_max = (2 * 26.2)
left_min = -26.2
xorigin(left) = 0.002 + (left - left_min) * xsize / width_max
yorigin = 0.02
set multiplot
# plot A
set xrange [-24.8:24.8]
set origin xorigin(-24.8),yorigin
set size xsize(2*24.8),(ysize+0.015)
plot ...
# plot B
set xrange [-24.8:24.8]
set origin xorigin(-24.8),(yorigin+0.19)
set size xsize(2*24.8),ysize+0.02
plot ...
# plot C
set xrange [-24.4:24.4]
set origin xorigin(-24.4),(yorigin+0.385)
set size xsize(2*24.4),ysize+0.02
plot ...
# plot D
set xrange [-26.2:26.2]
set origin xorigin(-26.2),(yorigin+0.58)
set size xsize(2*26.2),ysize+0.02
plot ...
# plot E
set xrange [-20.0:20.0]
set origin xorigin(-20),(yorigin+0.77)
set size xsize(2*20),ysize+0.02
plot ...
只需浏览一下,我就发现您正在为每个子图设置不同的xranges。只要坚持一个(可能是最大的,
[-26.2:26.2]
)就可以解决你的问题,如果我理解正确的话。没有数据无法检查。亲爱的#vaettchen,我已经重新编辑了我的帖子,使xrange对所有绘图都相同。我得到一个图表,如图所示。我不想在所有情节的两面都有任何“负面影响”。#克里斯托夫谢谢你的回答。它不起作用。我只得到相同的图形图。这里我给出了dropbox中的链接,您可以在其中找到名为“dataFile.tar”的文件。此文件包含所有数据。链接是()亲爱的#Christoph,我可以得到我想要的图表。脚本中有一个打字错误。真的再次感谢你,不客气。我没有时间用数据文件深入研究你的脚本。这是我的角色,还是你改编的角色?