[R] funny arrows
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Wed Sep 6 18:47:42 CEST 2000
On 6 Sep 2000, Peter Dalgaard BSA wrote:
> "Ritter, Christian C SRTCL-CTGAS" <Christian.C.Ritter at OPC.shell.com> writes:
> > The result of
> > > plot(c(-1,1),c(-1,1),type="n")
> > > arrows(0,0,1,1)
> > > arrows(0,0,0,0)
> > is not what I expected. The first arrow is drawn correctly. The second
> > does not collapse to a point but goes from (0,0) off to
> > (-infinity,infinity).
I thought screens of infinite size were infinitely expensize and/or
> > I guess something is divided by zero in the internal function.
> R-1.1.1 on Linux behaves OK (if a lonely arrowhead at (0,0) pointing
> left is OK)
Clearly it is not, as there is no information on the arrowhead direction.
As others have reported, what happens depends on the precise run-time
system in use (so `Linux' is too vague here). Internally R computes
atan2(0,0), and most systems will give 0.0 but that is hardly a definitive
answer. For what it is worth, the prototype of the next version of
R for Windows gives a left-pointing arrow too.
S-PLUS gives nothing, and I think that is the right answer. Indeed,
arrows(0,0,1e-8, 0) gives nothing too.
Brian D. Ripley, ripley at 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-help 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-help-request at stat.math.ethz.ch
More information about the R-help