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

Bounding box in eps output

545 views
Skip to first unread message

Stefan Essebier

unread,
Dec 16, 1996, 3:00:00 AM12/16/96
to

Greetings,

is there any way of getting gnuplot to put a 'strict' bounding box around
eps pictures? Normally, there is some white space between the bounding
box and the actual graph, and I have to run ps2epsi on the eps file
generated by gnuplot. I'm using

set terminal postscript eps "Times-Roman" 18

Regards,

Stefan Essebier

----
Stefan Essebier
Institute for Statics and Dynamics of Aerospace Structures
University of Stuttgart, Germany
email: esse...@isd.uni-stuttgart.de

David Denholm

unread,
Dec 16, 1996, 3:00:00 AM12/16/96
to

Stefan Essebier (esse...@isd.uni-stuttgart.de) wrote:
> Greetings,

> is there any way of getting gnuplot to put a 'strict' bounding box around
> eps pictures? Normally, there is some white space between the bounding
> box and the actual graph, and I have to run ps2epsi on the eps file
> generated by gnuplot. I'm using

> set terminal postscript eps "Times-Roman" 18

well, gnuplot tries its best ! But it can only guess the width
that postscript text will occupy.
3.6 offers set lmargin to over-ride auto calculations, but
it seems to add little bits to the configured origin gratuitously.
This is something I need to fix.

in 3.6 you can set the bounding box 'almost' manually...

set size ...
set origin ...
set multiplot # sets bounding box based on size and origin
set size ... # real size
set origin ... # real origin
plot ..
set nomulti


dd
--
david....@isltd.insignia.com
Tel +44 (0)1494 453376 (work) +44 (0)1494 459742 (home)

Thomas Schler

unread,
Dec 16, 1996, 3:00:00 AM12/16/96
to

Stefan Essebier wrote:
>
> Greetings,
>
> is there any way of getting gnuplot to put a 'strict' bounding box around
> eps pictures? Normally, there is some white space between the bounding
> box and the actual graph, and I have to run ps2epsi on the eps file
> generated by gnuplot. I'm using
>
> set terminal postscript eps "Times-Roman" 18
>

A really simple way to create the 'best' BoundingBox is editing
the PostScript file itself.

First step is to find a rectangle which surrounds your drawing.
Look into the PostScript file and find the first 'translate'
command, usually followed by the 'scale' command. Just a line
above 'translate' insert e.g. the line

35 103 moveto 450 0 rlineto 0 555 rlineto -450 0 rlineto closepath
stroke

Modify the digits 35, 103, 450, 555, -450 until you think the drawn
rectangle could define the wright BoundingBox.

Second step is to write the definition of the BoundingBox just on the
2nd line of the PostScript file or modify the original BoundingBox-line
written by gnuplot, e.g.

%%BoundingBox: 35 103 485 658

35 103 are the coordinates of the lower right corner of the BoundingBox.
485 658 are the coordinates of the upper left corner of the BoundingBox.
485 = 450 + 35
658 = 555 + 103

This is my way to find the wright BoundingBox. Of course, you'll get
into trouble if you want to produce several PostScript files automati-
cally. But maybe, using the UNIX tools sed or awk can help.

Greetings
Thomas

Stefan Essebier

unread,
Dec 17, 1996, 3:00:00 AM12/17/96
to

In article <32B582...@seismo.ifg.ethz.ch>,

Thomas Schler <sch...@seismo.ifg.ethz.ch> wrote:
>
>A really simple way to create the 'best' BoundingBox is editing
>the PostScript file itself.

This is true, but, as you say further down, it can get tedious.

I think running ps2epsi on the eps file produced by gnuplot is a lot
simpler than the way you describe to find the right box. The resulting
epsi file contains the line

%%BoundingBox: 35 103 485 658 (or whatever)

of course, and this line can be copied directly into the eps file. A
shell script using sed could be the best way to go in order to automate
this.

Thanks for your help,

Stefan.

Ong Teng Jin

unread,
Dec 17, 1996, 3:00:00 AM12/17/96
to

Dear Sir,

Please remove my email address from the mailing list.

Thanks.

Andre Mondry

unread,
Dec 18, 1996, 3:00:00 AM12/18/96
to

Stefan Essebier (esse...@uhura.isd.uni-stuttgart.de) wrote:
: In article <32B582...@seismo.ifg.ethz.ch>,

: Thanks for your help,

: Stefan.


I don't know about ps2epsi, but I use ghostview in order to read the BB
directly from the image - no way to automate this, though!

Regards,

Andre


0 new messages