# GNUPlot generated EPS figure in latex

• LaTeX
Dear Forum
I would like to establish a workflow of how to include .eps graphics generated with gnuplot into Latex documents and it would be great if other could contribute to this.
At the moment its like this. I plot some data with gnuplot and save it to a .eps file. However, the "white-space" margin to the left and right are too large (so placing to figures next to eachother looks bad).
First question: What is the smartest way of generating a bounding box that does not include so much white space? Of course, I can edit the eps file, but still, doing it for 5, 10 or more files is impractical.
Second question: what latex compiler do I need to be able to compile the document with the eps figures? PDFLATEX does not work, it requires PNGs or PDFs. So i need to convert the eps files first to pdfs, which is also impractical to do everytime I need to change a label.
Third question: How can PNGs be combined with vector graphics in the same latex document?

So, I really would like to establish this for me now once and for all. Maybe its also usefull to others.

robphy
Homework Helper
Gold Member
Consult for example http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics

I use the following packages:
graphicx (for importing raster graphics [I use png and sometimes eps])
pstricks (for fancy vector graphics).
You can use the ordinary picture environment if you don't need fancy graphics.

graphicx can display a specified region of your graphics file, effectively cropping for display without altering the original.

In a pspicture or picture environment,
I import the graphics [using includegraphics from graphicx],
then draw my vector graphics on top of it (for example, adding text, symbols, arrows, or other LaTeX graphics). Some trial and error is involved to do the positioning.

Scripting (e.g., with perl or python) can help with repetitive tasks.
I use ImageMagick's identify to help get the pixel dimensions of my graphics files.
I use a perl script to read its output and have it write the includegraphics command with bounding box dimensions and scaling information.
I actually use an additional program to send its output to my clipboard so that I can paste it in my editor.

Last edited:
D H
Staff Emeritus
Second question: what latex compiler do I need to be able to compile the document with the eps figures? PDFLATEX does not work, it requires PNGs or PDFs. So i need to convert the eps files first to pdfs, which is also impractical to do everytime I need to change a label.
You shouldn't have to reconvert every time you change the label. The label should not be a part of the graphic. Label the figure with the \caption command:

Code:
\begin{figure}
\centering
\includegraphics{name_of_file_containing_graph}
\caption{Caption that gives meaning to the graph}
\label{some_unique_label}
\end{figure}

@pf mentor: sorry, was not clear here. didnt mean the lable. Rather say the axis or the key/legend of the diagram.

D H
Staff Emeritus