2016-12-17 121 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