我编写了一个Gnuplot代码,该代码在一个窗口上绘制了两个图形。我希望在一个窗口中显示总共八个情节。这是给定一个窗口中两个图的代码:
#!/usr/bin/gnuplot
reset
set terminal pngcairo size 1000,1000
set output 'spectrogram.png'
set multiplot
unset key
set lmargin at screen 0.1
set rmargin at screen 0.9
set bmargin at screen 0.3
set tmargin at screen 0.9
set label 1 '(a)' font "Times, 15" at 0.8,15 right
set label 2 '(b)' font "Times, 15" at 7.5,90 right
set size ratio 2.5
set style data lines
set xtics format ""
set x2tics nomirror
set ytics out nomirror
set ytics 0,15
set x2label "Vs (km/s)" offset 1
set ylabel 'Depth (km)' offset 1
set xrange [0:5]
set yrange [200:0]
plot 'KUMBHZ.out' lc rgb 'red' lw 2.0 with fsteps,\
'finalmod' lc rgb 'cyan' lw 2.0 with fsteps,\
'modl.out' lc rgb 'navy' lw 2.0 with fsteps,
reset
set size ratio 0.9
set style data points
set xtics 0,10
set border lw 1.5
set ytics 0,0.5
set x2label "Period (s)" offset 1
set ylabel "Group Velocity (km/s)" offset 1
set xrange [10:102]
set yrange [2.5:4.5]
set label 3 at 80,3
set label 3 "C1 (LHMI)" center font "Times, 16"
unset key
set lmargin at screen 0.42
set rmargin at screen 0.8
set bmargin at screen 0.33
set tmargin at screen 0.9
plot 'DSP.out' lc rgb 'red' lw 2.0 with lines,\
'weig' lc rgb 'cyan' lw 2.0 with lines,\
'disp.d' lc rgb 'navy' lw 2.0 with lines,\
'weig.eror' w yerrorbar pt 0 lc black
unset multiplot
我有总共8张图像的相似数据,其中两个显示在上面。我希望在一个窗口上设置8张图像。
答案 0 :(得分:2)
您是否在gnuplot中键入help multiplot
?
通常,在多图中需要更多选项。开始于:
set multiplot layout 2,4 margins 0.04, 0.98, 0.08, 0.98 spacing 0.03,0.02
layout 2,4
选项将为您提供2行和4列图形。或者,您可能希望layout 4,2
。 margins
定义了所有图形的边距。 spacing
定义图形之间的空间。在本示例中,它们的尺寸非常小,因为我完成了一些工作,即所有图形都具有相同的轴,因此我只在底部和左侧的图表上贴标签。