I am trying to plot a function in gnuplot with epslatex terminal to be included in a Latex file:
reset
set terminal epslatex color
set xlabel '$x$'
set ylabel "$f(x)$" rotate by 90
set output 'out.tex'
plot x
set output
Then I use \input{out.tex}
in the Latex file to include the plot in the resulting dvi file. Unfortunately,
- there are no tick labels on either axis,
- the y axis label is not rotated.
Interestingly, the tick labels are included in the generated out.tex file (e.g. \put(2410,484){\makebox(0,0){\strut{}$-5$}}%
) but not displayed in the dvi file.
Also, the rotation for the y axis label is included in the out.tex file:
\put(209,2761){\rotatebox{90}{\makebox(0,0){\strut{}$f(x)$}}}%
but not rotated in the dvi file.
If I replace set terminal epslatex color
with set terminal latex
or even set terminal latex rotate
then the tick labels appear but the y axis label is still not rotated.
It is also strange to me that if I compile the tex file with pdflatex (instead of latex) then the resulting pdf file only contains the tick mark labels and the axis labels (no frame, no axis, no ticks, no plot).
Can you please explain this behaviour?
latex example.tex
, thendvips example.dvi
, thenps2pdf example.ps
results in the correct output for your code on my system, with the rotated f(x) label. I tried also withdvipdfm
to convert the dvi directly to pdf but this didn't work properly, the labels were displayed but the location had shifted so it didn't align with the plot itself.