I'm trying to export my gnuplot graph for use with (pdf)latex. A couple of
days ago on this NG
set terminal epslatex color
was mentioned as solution. Epstopdf can then be used to convert the EPS
file created by gnuplot into PDF.
Now the problem : my graph is square but the EPS file is a 5 inch by 3 inch
rectangle which leaves a lot of whitespace and makes centering the graph
that much more difficult. Is there anything I can do to influence the size
and shape of the EPS file ? A margin of a couple of millimeters on each side
of the graph would be sufficient.
set size square
only changes the axes of the plot.
Thank you for your time,
Daniel Winkelmann
Others may comeup with more elegant solution. Here is what I do to
include graphs in latex
set terminal postscript eps enhanced color
set output "cheb_pl.eps"
and when it comes to including eps file in .tex file, I use
\begin{figure}[htpb]
\begin{center}
\includegraphics{cheb_pl.eps}
\end{center}
\caption{variation of chebyshev polynomials}
\label{fig:cheb}
\end{figure}
hope that helps
raju
[Using epslatex terminal...]
> Now the problem : my graph is square but the EPS file is a 5 inch by 3 inch
> rectangle which leaves a lot of whitespace and makes centering the graph
> that much more difficult.
The tricky question here is *how* you made your graph square. "set
size square", which is equivalent to "set size ratio 1.0" doesn't
affect gnuplot's idea of the page size, and thus not the EPS
BoundingBox, either. It only changes what part of the page is
actually used by the graph box.
To get a squae "page", you have to, e.g.
set size 3.0/5.0, 3.0/3.0
and do it before you 'set term' and 'set output'. Try this:
set size 3.0/5, 1
set term epslatex
set out 'mypic.eps'
plot x
set out
and you should find the .eps file has a size of 3x3 square inches.
Another possibility would be to run 'ps2epsi' on the generated eps
file and replace the gnuplot-generated file with the result. This
will recalculate the bounding box. But this risks breaking the
alignment of the PostScript and LaTeX parts of the plot.
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
I'd like to avoid having to clip
\includegraphics[trim=0 0 135 0,clip]{toowide.eps}
in my LaTex file instead I'd like to create an EPS of the right size.
Daniel Winkelmann
set size 3.0/5.0, 3.0/3.0
works like a charm, thanks,
Daniel Winkelmann
> Now the problem : my graph is square but the EPS file is a 5 inch by 3 inch
> rectangle which leaves a lot of whitespace and makes centering the graph
> that much more difficult. Is there anything I can do to influence the size
> and shape of the EPS file ? A margin of a couple of millimeters on each side
> of the graph would be sufficient.
EPS-files can be edited with a plain text editor (Notepad, if you have
nothing else).
Somewhere near the beginning of an eps-file, you will find a boundingbox
statement, containing the coordinates of the lower left and upper right
column. Changing those coordinates will affect the amount of white space
on the graph.
If you use GhostView to display the graph you can set display of the
bounding box on, to see where things need trimming.
Not elegant, but if you don't have too many graphs to work on probably
the easiest solution.