GNUplot

Notes on using GNUplot

Outputting from GNUplot to PDFLaTeX

In gnuplot:

set format "$%g$";
set terminal epslatex colour solid size 15cm, 10cm
set output “graph.tex” # DO NOT USE UNDERSCORES!!!plot etc...
unset output # forces buffer to flush

This will output 2 files: graph.tex and graph.eps.

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:

\usepackage{graphicx}
\usepackage{epstopdf}  % link to documentation\input{graph.tex}

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

Add new comment