[Rd] arrows() doesn't like zero-length arrows (PR#727)

stephen@cogsci.ed.ac.uk stephen@cogsci.ed.ac.uk
Tue, 7 Nov 2000 21:12:37 +0100 (MET)


Hi,

By going through the mailing list archives, I noticed that people use
the arrows() command to add error bars to their plots.  I think there
is a problem when trying to draw arrows of zero length.  In the
following code, certainly the x driver produces an odd-angled line.
In the postscript device, NaNQ values are generated; when the
postscript file is viewed in Ghostview, an error is then generated.

Sample run:

postscript(file="test.ps")
x <- c(0, 1, 2)
y <- c(0, -0.5, 0.3)
s <- c(0, 0.1, 0.1)
plot(x,y)
arrows(x, y-s, x, y+s, code=3, angle=90)
dev.off()

Looking in the file test.ps I see the following (around line 160):

np
103.58 354.24 m
103.58 354.24 l
o
np
NaNQ NaNQ m
103.58 354.24 l
NaNQ NaNQ l

This was with R Version 1.1.1  (August 15, 2000) (running on OSF/1).



Stephen

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._