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

Wrong standard BoundingBox in terminal postscript eps

332 views
Skip to first unread message

Jens Damerau

unread,
Apr 10, 2008, 4:13:13 PM4/10/08
to
Hello,

Recently I noticed a problem with the standard BoundingBox of the
"terminal postscript eps". In the example below, the lower part of the
letter "g" is already outside the BoundingBox.
Although fixbb may be used to correct the box, it also changes all other
borders leading to inconsistent left and right borders if applied to
many files.
Is there any known solution to automatically correct these problems? Is
this behaviour considered to be a bug in gnuplot?
I am using gnuplot version 4.2.3, but have also tested versions 4.2.0
and 4.0.0.

Regards, Jens

%%%%%%%%%% Example file %%%%%%%%%%

set terminal postscript eps
set output "test.eps"
set xlabel "g"
plot x

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% gnuplot version %%%%%%%%%%

G N U P L O T
Version 4.2 patchlevel 3
last modified Mar 2008
System: CYGWIN_NT-6.0 1.5.25(0.156/4/2)

Copyright (C) 1986 - 1993, 1998, 2004, 2007, 2008
Thomas Williams, Colin Kelley and many others

Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from http://www.gnuplot.info/faq/

Send bug reports and suggestions to
<http://sourceforge.net/projects/gnuplot>

Compile options:
-READLINE +LIBREADLINE +HISTORY +BACKWARDS_COMPATIBILITY +BINARY_DATA
+GD_PNG +GD_JPEG +GD_TTF +GD_GIF +ANIMATION
+NOCWDRC +X11 +X11_POLYGON +MULTIBYTE +USE_MOUSE +HIDDEN3D_QUADTREE
+DATASTRINGS +HISTOGRAMS +OBJECTS +STRINGVARS +MACROS +THIN_SPLINES
+IMAGE


DRIVER_DIR = "/usr/sbin/gnuplot/4.2"
GNUPLOT_PS_DIR = "/usr/share/gnuplot/4.2/PostScript"
HELPFILE = "/usr/share/gnuplot/4.2/gnuplot.gih"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Ethan Merritt

unread,
Apr 10, 2008, 6:20:57 PM4/10/08
to
In article <667amqF...@mid.dfncis.de>,

Jens Damerau <jens.d...@uni-dortmund.de> wrote:
>Hello,
>
>Recently I noticed a problem with the standard BoundingBox of the
>"terminal postscript eps". In the example below, the lower part of the
>letter "g" is already outside the BoundingBox.
>Although fixbb may be used to correct the box, it also changes all other
>borders leading to inconsistent left and right borders if applied to
>many files.
>Is there any known solution to automatically correct these problems? Is
>this behaviour considered to be a bug in gnuplot?

I agree it is annoying. But the only fix I can suggest is to tell
gnuplot you want a larger margin at the bottom:
set bmargin 3 # default is 2 character heights; we want more space

The basic problem is that gnuplot has only a guess as to how much space
text occupies. It tries to draw within the bounding box, but if its
guess about how much space the text needs is too low then the text
extends across the bounding box.

I wouldn't use fixbb for something like this, however.
Since you know exactly what the problem is, you should know exactly
what the fix is also. In particular, you want to edit the line in
the *.eps output file that says:
%%BoundingBox: 50 50 410 302
to say instead
%%BoundingBox: 50 48 410 302

or however much extra room your chosen font needs (did I mention that
this is font-dependent?). The change will be identical for all plots
made with the same "set term post eps" command.

You may now be wondering "why can't gnuplot itself change the 50 to
a 48?"... But remember, gnuplot accepts the bounding box as a target
size to draw in. If you ask it to start with a bigger bounding box,
it will just decide to spread everything out that much more, and you
will have the same problem all over again.


--
Ethan A Merritt

Petr Mikulik

unread,
Apr 10, 2008, 6:16:23 PM4/10/08
to Jens Damerau
> Recently I noticed a problem with the standard BoundingBox of the "terminal
> postscript eps". In the example below, the lower part of the letter "g" is
> already outside the BoundingBox.
> Although fixbb may be used to correct the box, it also changes all other
> borders leading to inconsistent left and right borders if applied to many
> files.
> Is there any known solution to automatically correct these problems? Is this
> behaviour considered to be a bug in gnuplot?

Almost no program with (encapsulated) postscript output produces perfectly
correct bounding box. It's only the postscript interpret that can find these
numbers correctly. Using fixbb for really correct b.b. is a must.

---
PM

Jens Damerau

unread,
Apr 10, 2008, 8:03:26 PM4/10/08
to
Ethan Merritt schrieb:

> I agree it is annoying. But the only fix I can suggest is to tell
> gnuplot you want a larger margin at the bottom:
> set bmargin 3 # default is 2 character heights; we want more space

Hi Ethan!

Thank you very much, that fixes my problem.

> The basic problem is that gnuplot has only a guess as to how much space
> text occupies. It tries to draw within the bounding box, but if its
> guess about how much space the text needs is too low then the text
> extends across the bounding box.

Yes, I see the point. Still, it would be nice if gnuplot's standard
guess worked well at least with the default Helvetica font. If I had
changed the font, I would not have been surprised too much; however, I
expected that everything would be correct "out of the box" with the
default parameters.

Best regards, Jens

Jens Damerau

unread,
Apr 11, 2008, 12:40:33 PM4/11/08
to
Petr Mikulik wrote:
> Almost no program with (encapsulated) postscript output produces perfectly
> correct bounding box. It's only the postscript interpret that can find these
> numbers correctly. Using fixbb for really correct b.b. is a must.

Hi Petr,

Thank you for your answer.
The problem with fixbb can be, that it always adjusts/reduces all
borders to exactly match the corresponding picture. In some cases, for
example when one tries to include and align multiple eps files on one
page, this might be a problem.
I rather like the way gnuplot usually leaves some extra space around the
plots in a defined way. This makes a subsequent alignment of the plots
easier. "set bmargin" did the trick for me.

Best regards, Jens

0 new messages