我试图按照列顺序绘制五个图形(a,b,c,d,e),如下所示。
每个绘图的x刻度是不同的,它们不在垂直线上,但图(c),(d)和(e)具有几乎相似的x范围值,即24.8。
当我按列顺序绘制这些图形时,我发现标记为(a)和(b)的图形分别被拉伸和压缩。 然而,标记为(c),(d)和(e)的图具有相同的标度长度。
我垂直绘制了一条红线,以显示每个图形的x比例是如何对齐的。 (请参阅附图)
我使用的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
有人可以查看这个问题并帮助我按照我所示的方式获取多个时间段,但让每个绘图的比例按垂直顺序排列吗?
如果图形尺寸很小或很大,则可以。
但我希望比例尺垂直排列。
感谢您的所有帮助。
谢谢。
如果我编辑set xrange [-26.2:26.2]
对所有人来说都是相同的,那么我会得到以下内容......我不想要。我只想在第一张照片中展示。
答案 0 :(得分:1)
基本上你必须调整绘图大小和原点的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 ...