stephen@cogsci.ed.ac.uk
2000-Nov-07 20:12 UTC
[Rd] arrows() doesn't like zero-length arrows (PR#727)
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2000-Nov-07 21:58 UTC
[Rd] arrows() doesn't like zero-length arrows (PR#727)
On Tue, 7 Nov 2000 stephen@cogsci.ed.ac.uk wrote:> 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).OS-specific (most OSes do sensible things), and already solved in the development version. There was some discussion of this (Christian Ritter) on R-help AFAIR a while back. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._