2016-12-17 147 views
1

我想對齊一個繪圖的標題。其中一些人離開,其中一些人是對的。Gnuplot左右對齊字幕

我在策劃方案是這樣的:

set key title "Gaussian Distribution" 
set key top left Left reverse samplen 1 

plot d1(x) fs solid 1.0 lc rgb "forest-green" title "μ = 0.5 σ = 0.5", \ 
d2(x) lc rgb "gold" title "μ = 2.0 σ = 1.0", \ 
d3(x) lc rgb "dark-violet" title "μ = -1.0 σ = 2.0" 

現在我想有黃色和綠色的右手邊,紫左側。如何在繪圖命令中更改按鍵?

回答

1

可以使用的multiplot環境是這樣的:

d(x,mu,sigma) = exp(-(x-mu)**2/(2.0*sigma**2))/(sigma*sqrt(2.0*pi)) 
titleformat="μ = %.1f, σ = %.1f" 

set xrange [-10:10] 
set yrange [0:1] 

set yzeroaxis 

set samples 1000 
set terminal pngcairo 
set output "gaussians.png" 


set multiplot 

set key title "Gaussian Distribution" 
set key top left Left reverse samplen 1 
plot mu=-1.0, sigma=2.0, d(x, mu, sigma) lc rgb "dark-violet" title sprintf(titleformat, mu, sigma) 

set key title " " 
set key top right reverse samplen 1 

plot mu=0.5, sigma=0.5, d(x, mu, sigma) lc rgb "forest-green" title sprintf(titleformat, mu, sigma) ,\ 
    mu=2.0, sigma=1.0, d(x, mu, sigma) lc rgb "gold" title sprintf(titleformat, mu, sigma) 

unset multiplot 

注意,整整重疊地塊範圍必須明確指定。

Gaussians with key left and right