Use of lwd = 0, lty = 2 in segments. (PR#230)

bates@stat.wisc.edu bates@stat.wisc.edu
Sun, 18 Jul 1999 00:16:10 +0200 (MET DST)


This may not be considered a bug but it is an incompatibility with S.

There was a convention in S that the graphics parameter setting 
 lwd = 0 
is supposed to use the minimum possible line width on the device.  It
is not clear what that means on modern graphics devices but there is
still code (like mine) that assumes something sensible happens with
 lwd = 0
It seems that R's postscript device driver does something reasonable
with that for some graphics functions but not others.  The abline
function seems ok but the segments function doesn't.

The following produces a PostScript output file "foo.ps" that causes
ghostscript to complain of an error.
R> postscript("foo.ps")
R> plot(1:10, 1:10, type = "n")
R> abline(h = 5, lty = 2, lwd = 0)   # works properly
R> segments(1, 1, 1, 3, lty = 2, lwd = 0)  # fails
R> dev.off()

The last part of the PostScript file is

0.75 setlinewidth
[ 3.00 3.00] 0 setdash
np
77.04 290.39 m
743.76 290.39 l
o
0.00 setlinewidth
[ 0.00 0.00] 0 setdash
np
101.73 107.87 m
101.73 199.13 l

It is the line "[ 0.00 0.00] 0 setdash" that causes the problems.

The error message from Ghostscript is

Error: /rangecheckAladdin Ghostscript: Unrecoverable error, exit code 1
 in --setdash--
Operand stack:
   --nostringval--   0
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   2   3   %oparray_pop   --nostringval--   --nostringval--
Dictionary stack:
   --dict:874/941(G)--   --dict:0/20(G)--   --dict:75

I notice that in the C function PostScriptSetLineTexture in devPS.c,
the step lengths seem to be multiplied by something that may be the
line width before being written to the PostScript file.

--please do not edit the information below--

Version:
 platform = i686-unknown-linux
 arch = i686
 os = linux
 system = i686, linux
 status = 
 status.rev = 0
 major = 0
 minor = 64.2
 year = 1999
 month = July
 day = 3
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._