2016-03-08 51 views
-1

我想在gnuplot中垂直堆疊模式中繪製5個圖形。有許多水平(x軸共享)圖。我試圖調整他們的解決方案。但不知何故不起作用。這是代碼。在gnuplot中垂直堆疊的多插槽

set key bottom center 
NX=5; NY=1 
DX=0.01; DY=0.01; SX=0.25; SY=0.85 
set bmargin DX; set tmargin DX; set lmargin DY; set rmargin DY 
set size SX*NX+DX*4,SY*NY+DY*4 
set multiplot layout 1,5 #title 'Distance from inlet boundary' font #'areal,18' 

#1set title 'sa4(210)' 
set size SX,SY 
set label 1 '50m' at 1.5, 1.5 #font 'areal,15' 
set x2tics (0, 0.01, 0.02) 
set xtics (0, 2, 4) 
set ytics (-15, -10, -5, 0) 
set x2range [-0.001:0.02] 
set xrange [0:4] 
set yrange [-15:0] 
set ylabel 'metre(s) below sea level' 
set key bottom 
set xtics nomirror #smooth bezier w p csplines 
set origin DX,DY; 
plot 'so10.dat' u 2:1 w p pt 7 lc rgb 'red' title 'Salinity' axes x2y1,\ 
     'so10.dat' u 3:1 w p pt 8 lc rgb 'blue' title 'Sediment' axes x1y1 

#2set title 'sa4(210)' 
set size SX,SY 
set label 1 '250m' at 1.5, 1.5 #font 'areal,15' 
set x2tics (0, 0.01, 0.02) 
set xtics (0, 2, 4) 
set x2tics 
set x2range [-0.001:0.02] 
set xrange [0:4] 
unset ylabel 
unset ytics 
set key bottom 
set xtics nomirror #smooth bezier w p csplines 
set origin DX+SX,DY; 
plot 'so50.dat' u 2:1 w p pt 7 lc rgb 'red' title 'Salinity' axes x2y1,\ 
     'so50.dat' u 3:1 w p pt 8 lc rgb 'blue' title 'Sediment' axes x1y1 

#3set title 'sa4(210)' 
set size SX,SY 
set label 1 '750m' at 4.0, 1.5 #font ',15' 
set x2tics (0, 0.01, 0.02) 
set xtics (0, 5, 10) 
set x2tics 
set x2range [-0.001:0.02] 
set xrange [0:10] 
unset ylabel 
set key bottom 
set xtics nomirror #smooth bezier w p csplines 
set origin DX+SX*2,DY; 
plot 'so150.dat' u 2:1 w p pt 7 lc rgb 'red' title 'Salinity' axes x2y1,\ 
     'so150.dat' u 3:1 w p pt 8 lc rgb 'blue' title 'Sediment' axes x1y1 

#4set title 'sa4(210)' 
set size SX,SY 
set label 1 '850m' at 4.0, 1.5 #font ',15' 
set x2tics (0, 0.01, 0.02) 
set xtics (0, 6, 12) 
set x2tics 
set x2range [-0.001:0.02] 
set xrange [0:12] 
unset ylabel 
set key bottom 
set xtics nomirror #smooth bezier w p csplines 
set origin DX+SX*3,DY; 
plot 'so170.dat' u 2:1 w p pt 7 lc rgb 'red' title 'Salinity' axes x2y1,\ 
     'so170.dat' u 3:1 w p pt 8 lc rgb 'blue' title 'Sediment' axes x1y1 

#5set title 'sa4(210)' 
set size SX,SY 
set label 1 '950m' at 4.0, 1.5 #font ',15' 
set x2tics (0, 0.01, 0.02) 
set xtics (0, 5, 10) 
set x2tics 
set x2range [-0.001:0.02] 
set xrange [0:10] 
unset ylabel 
set key bottom 
set xtics nomirror #smooth bezier w p csplines 
set origin DX+SX*4,DY; 
plot 'so190.dat' u 2:1 w p pt 7 lc rgb 'red' title 'Salinity' axes x2y1,\ 
     'so190.dat' u 3:1 w p pt 8 lc rgb 'blue' title 'Sediment' axes x1y1 

unset multiplot 

它給出了一個下面4個圖。代碼必須生成5個圖。 Generated image

原始圖像如下。我想刪除圖形之間的空白區域。 Original image

回答

0

Gnuplot空間不足。您需要修復您的set sizeset origin命令,以便您不在繪圖區域外繪圖。現在,您的SX=0.25意味着每個子圖的水平尺寸佔用可用空間的25%,因此只有4個子圖可以適合此設置。然後需要將第五個子圖放置在繪圖區之外。

還要注意,通過設置原點和大小,您將覆蓋已定義的multiplot layout

通常,在做這種繪圖風格時,定義邊距而不是大小和原點可能是一個更好的主意。

+0

謝謝。我知道了。 –