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

Odd behavior with 'set margin' for negative values

218 views
Skip to first unread message

Darby

unread,
Dec 3, 2009, 3:28:25 PM12/3/09
to
Hello,

I'm getting some odd results when using a negative value for a 'set
margin' command. This causes the value of the margin to get set to
'screen -1'. See the example below. I know this seems like an odd
thing to do but I use the postscript terminal and like to use the
margins for extra space. I think the current behavior isn't
consistent with the documentation. In the entry for 'help set margin'
it says:

A negative value (or none) causes `gnuplot` to revert to the
computed value.

It would be great if negative values were allowed when using the 'at
screen' option. A negative value without the screen option (e.g. set
bmargin -1) or just 'unset bmargin' could still be used for reverting
to the computed value.

I've tested this with the latest CVS version on x86_64.

% cat test.gnu
set lmargin screen -0.01
set rmargin screen 1.01
set bmargin screen -0.01
set tmargin screen 1.01

plot x
pause -1

show margin
% gnuplot test.gnu

lmargin is set to screen -1
bmargin is set to screen -1
rmargin is set to screen 1.01
tmargin is set to screen 1.01
%

sfeam

unread,
Dec 3, 2009, 7:18:08 PM12/3/09
to
Darby wrote:

> Hello,
>
> I'm getting some odd results when using a negative value for a 'set
> margin' command. This causes the value of the margin to get set to
> 'screen -1'. See the example below.

That does indeed seem to be a bug.
Thanks for the report.

> I know this seems like an odd
> thing to do but I use the postscript terminal and like to use the
> margins for extra space. I think the current behavior isn't
> consistent with the documentation. In the entry for 'help set margin'
> it says:
>
> A negative value (or none) causes `gnuplot` to revert to the
> computed value.
>
> It would be great if negative values were allowed when using the 'at
> screen' option.

Screen coordinates run from 0 to 1. Values outside that range have no
meaning. They are, by definition, "off the screen". The result of
trying to draw off the screen ranges from relatively harmless (PostScript)
to immediately fatal (several bitmapped terminals for which this means
writing outside of allocated memory). I hope that we have managed to
fix all places in the code that result in writing off-screen, although
it wouldn't surprise me terribly if we had missed a few.

For exactly this reason, most of the current terminals enforce clipping
of all elements to the screen boundaries. A few terminals, in particular
postscript, have been exempted so far because old scripts counted on
this behaviour. Nevertheless it is strongly discouraged, if only because
your plot commands won't work if you try to switch to another terminal
type.

Ethan

0 new messages