Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Graphics translation: eps bounding box question

From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: Graphics translation: eps bounding box question
Date   Wed, 07 Aug 2002 17:12:17 +0100

At 17:05 07/08/02 +0200, Eva Poen wrote:
Dear list readers,

I have encountered the following problem:
In the course of some descriptive analysis I need to create a total of ca.
120 graphs in Stata (MS Windows System). I have written a loop to do this
efficiently, and everything is fine to this end.
Now I want to convert part of the graphs to .eps format, in order to
include them into my LaTeX document. This can be done by typing something
- translate graphi`i'.gph graph`i'.eps -
in my loop. There are two problems with the bounding box of the resulting

1) The bounding box is not given in integers, but as i.e. "0.000 0.000
432.000 288.000". This causes ghostview/-script to complain. It should be
"0 0 432 288".
What version of GhostView/Script are you using? I use GSView Version 4.2 (dated 7 Feb 2002), and it can handle non-integer bounding boxes by converting them to integers for display purposes, although it queries the user before doing so. You can download the latest version from, although it will nag you every time you launch it about becoming a registered user.

2) The bounding box is calculated too large, leaving white space below the
graph. In my case this is about 1/3 of the whole picture.
You don't say what version of Stata you are using. Stata .EPS graphs used to be like that in the days of Stata 6. However, today (in Stata 7) the bounding box fits nicely round the graph, in my experience, except when you use the -by- option of -graph-, in which case Stata arranges the by-groups in a square array (so vertical and horizontal scaling are done by the same factor). In this case, if the number of by-groups is not a perfect square (eg 1, 4, 9, 16, 25 or 49), Stata wastes the excess space, and puts the bounding box round the full set of graphs that would be present if the number of by-groups was equal to the next perfect square upwards. The solution is probably to create a separate .EPS output for each by-group and then to tile them at the TeX or LaTeX level.

I would be very happy if at least problem 1) could be solved somehow from
within Stata (or in some other way). If the bb is given in integers,
epstool can correct the size of the bb. As long as the bb is not in
integers, epstool refuses to work.
I find that the -psbox- package in plain TeX, or the -figure- environment in Stata Journal LaTeX, handles my Stata-produced .EPS graphics without any trouble. (My TeX version is MiKTeX 2.0. The latest MiKTeX can be found on

I hope this helps.

Best wishes


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

Opinions expressed are those of the author, not the institution.

* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index