2017-04-11 117 views
1

我目前正試圖在Gnuplot中產生一個體面的多槽。可悲的是我遇到了一些問題。Gnuplot Multiplot個人情節大小+標籤

由於這兩個數字的y軸是相同的,我只想標註和抽取一次,但我不能刪除那些只從左邊的情節。

其次,我想增加左邊的繪圖的寬度,同時減少右邊的一個。

下面是我到目前爲止得到的圖片,代碼如下。

Plot so far

set term postscript eps enhanced color "Helvetica" 10 
set output "dosband.eps" 
set title "Bandstructure and Density of States" 
# 
set multiplot layout 1,2 \ 
       margins 0.075,0.98,0.1,0.98 \ 
       spacing 0.02,0.08 #margins: left,right,bottom,top; spacing: vertical, horizontal 
set title "Bandstructure" 
plot 'plotband.dat' using 1:2 with lines lt 1 lw 0.5 linecolor rgb "black" notitle 
set xlabel "Density [states/eV]" #dont ask me why I have to swap the xlabels around 
set ylabel "Energy [eV]" 
# 
set title "Density of States" 
plot 'plotdos.dat' using 1:2 with lines lt 1 linecolor rgb "black" notitle 
set xlabel "K-Points" 
unset multiplot 

預先感謝任何答案!

+0

使用'set multiplot margin ... spacing ...'恰好是具有相同大小的圖。如果你不想這樣做,你必須用'set margin ...'或'set {tbrl} margin'單獨設置圖的大小。 – Christoph

回答

1

正如@Christoph指出的那樣,使用顯式邊距是解決方案之一。在您的特定情況下,可以進行如下:

#dimensions are in screen units 
width_left = 0.48 
width_right = 0.25 
eps_v = 0.12 
eps_h_left = 0.1 
eps_h_right = 0.05 

unset key 

set multiplot 

set tmargin at screen 1. - eps_v 
set bmargin at screen eps_v 

set lmargin at screen 0.1 
set rmargin at screen eps_h_left + width_left 

set xr [0:1.4] 
set xtics 0,0.2,1.4 
set yr [-40:5] 
unset ytics 
set y2r [-40:5] 
set y2tics in mirror 
set format y2 "" #draw ticks but no tic labels 

set title "Plot 1" 
set xlabel "title 1" 
plot 1/0 

set lmargin at screen 1. - (width_right + eps_h_right) 
set rmargin at screen 1. - eps_h_right 

set xr [0:100] 
set xtics 0,25,100 
unset y2tics 
set yr [-40:5] 
set ytics in mirror 
set mytics 1 

set title "Plot 2" 
set xlabel "title 2" 
set ylabel "Energy [eV]" 
plot 1/0 

這將產生: enter image description here

萬一Energy [eV]標籤應該是完全移動到左側,可以相應地調整間距/抽搐。 ..

+0

謝謝,這真的很有幫助! – CGiant1807