[Tex/LaTex] gnuplot + epslatex

gnuplot

I'm using gnuplot with terminal epslatex in order to plot graphs containing LaTeX labels.

In particular I've got something like this on Y tics:

$\\frac{ L_{seq} }{ 8 }$

Everything works, but the output graph has a lot of white space between the Y axis label and the Y tics.

I guess that's because gnuplot parses $\\frac{ L_{seq} }{ 8 }$ as a normal string and reserves space for it, but the resulting string (after pdflatex renders it) will actually be shorter.

Any way to solve this?

Best Answer

In my experience it's best to let graphics programs such as gnuplot use their own (non LaTeX) labels, and then replace these using psfrag. psfrag allows you to align the left/right/centre of the object to be replaced with the left/right/centre of the replacement. So, in gnuplot try

set term postscript eps mono
set output 'myplot.eps'
set ylabel 'Y'
plot x**3

and then in your document

\usepackage{psfrag}

...

\psfrag{Y}[r][r]{$y=x^3$}
\includegraphics{myplot}