When using the epslatex
terminal, I always have to use the width command as well as \hspace
to get the LaTeX generated key labels properly aligned. Is there any way of getting this to work automatically? For example, I just wanted to use a key with two columns, but it was impossible to get it lined up properly (the first column would always overlap with the second).
Here is an example:
set terminal epslatex colortext color standalone "phv" 12 header "\\bfseries"
set output "figtmp1.tex"
set notitle
set nokey
set size 1,1
set origin 0,0
set xlabel "{\\Large $x$}"
set ylabel "{\\Large $y$}"
ti2 = "{\\large $S^{zz}_\\sigma(L/2)$}"
ti4 = "{\\large $S^{xx}_\\sigma$}"
set key Left top right vertical maxrows 1
f1(x) = x**1
f2(x) = x**2
plot \
f1(x) w lp lc rgb "red" t ti2,\
f2(x) w l lt 2 lc rgb "dark-grey" t ti4
This produces a two-column, one-line key where the line sample of f1(x) extends into the second column belonging to f2(x). Also, the spacing between the label and the corresponding line sample is much too large (this can be adjusted using width
).
A related formatting problem occurs for a regular (single-column) key:
set key Left top right
The labels appear to be centred. How do I align the labels, for example, to the left without using the LaTeX command \hspace
and determining the spacing needed by trial and error?
Best Answer
Remarks
I adjusted a few things, to make it work:
"{...}"
by'...'
, as wrapping things in{}
can break your spacing in some cases.'
. It won't work for"
).Left
inset key Left top right
. Honestly, I don't know what that even does.Implementation
Output