Reputation: 129
I want to align the titles of one plot. Some of them left and some of them right.
I‘m plotting in scheme like this:
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"
Now I would like to have yellow and green on the right hand side and violet on the left. How can one change the keys whilst in a plotting command?
Upvotes: 1
Views: 2563
Reputation: 4218
You can use a multiplot environment like this:
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
Note that for exactly overlapping plots the ranges must be explicitly specified.
Upvotes: 2