Gnuplot左右对齐线条

时间:2016-12-17 09:58:41

标签: bash 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 个答案:

答案 0 :(得分:1)

您可以使用这样的多重绘图环境:

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

相关问题