Notes on using GNUplot

### Outputting from GNUplot to PDFLaTeX

In gnuplot:

This will output 2 files: graph.tex and graph.pdf. (The “standard” technique is to let GNUplot output an EPS file and then use \usepackage{epstopdf} in the LaTeX preamble to convert the EPS file to PDF. But this appears rather broken in LyX >= 2.0.1. The tidiest solution would probably be to use the cairolatex output terminal in GNUplot 4.6 (released March 2012) but GNUplot 4.6 isn’t available on our college machines yet (I could manually install it to my own directory but that feels rather ugly). It looks like GNUplot 4.6 will be included in Ubuntu 12.10.) Exit gnuplot before opening the .tex file or run unset output! (Otherwise it won’t have finished emptying buffer!) (many more options listed in the epslatex section of the gnuplot documentation) In the LaTeX document:

Compile with: pdflatex --shell-escape LaTeXdoc.tex There’s some more help here: http://en.wikibooks.org/wiki/LaTeX/Tips_and_Tricks#Graphs_with_gnuplot

#### Settings in Lyx

1. Insert the \input{graph.tex} using Insert > TeX code (ctrl-L)
2. See this forum thread for how to set --shell-escape
3. Set the \usepackage lines in Document > Settings > LaTeX Preamble