Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

superfluous white space in eps file

2,848 views
Skip to first unread message

Daniel Winkelmann

unread,
Feb 12, 2004, 1:03:26 PM2/12/04
to
Hi,

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


Kamaraju Kusumanchi

unread,
Feb 12, 2004, 1:42:07 PM2/12/04
to
Daniel Winkelmann wrote:
> Hi,
>
> 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
>

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

Hans-Bernhard Broeker

unread,
Feb 13, 2004, 3:28:42 AM2/13/04
to
Daniel Winkelmann <kis...@club-internet.fr> wrote:

[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.

Daniel Winkelmann

unread,
Feb 13, 2004, 5:09:59 AM2/13/04
to
No not really, I know how to include the EPS in my LaTeX but the graph is on
the left of the EPS and on the right there are 2 inches of white space that
I don't want.

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


Daniel Winkelmann

unread,
Feb 13, 2004, 1:04:49 PM2/13/04
to
"Hans-Bernhard Broeker" <bro...@physik.rwth-aachen.de> a écrit

set size 3.0/5.0, 3.0/3.0

works like a charm, thanks,

Daniel Winkelmann


Dr Engelbert Buxbaum

unread,
Feb 16, 2004, 6:53:07 AM2/16/04
to
Daniel Winkelmann wrote:


> 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.


0 new messages