R-alpha: Bug[?] in axis(.) -- using format(.) for labels can give nonsense

Peter Dalgaard BSA p.dalgaard@kubism.ku.dk
29 Oct 1997 02:28:35 +0100


Martin Maechler <maechler@stat.math.ethz.ch> writes:

> 
> To see what I mean,
> try
> 
>  x11()
>  par(mfrow=c(2,1))
>  x <- 1:100
>  plot(x, sin(pi*x/100))
>  options(digits= 20)
>  plot(x, sin(pi*x/100))
> 
> The problem really is in  axis(.) which uses  format(.) for the axis
> labels.
> I think  the result of axis(.) should NOT be influenced by
> 
> 	options()$digits.
> 
> Should I change it?

Hm. The root of the problem is this:
>  options(digits= 20)
> 0:5*0.1
[1] 0.00000000000000000 0.10000000000000001 0.20000000000000001
[4] 0.30000000000000004 0.40000000000000002 0.50000000000000000

I.e. the plot labels get a large number of digits because of numerical
inaccuracy, and then there's only room for one of them on the axis.
I say you deserve what you get... 

I'm a bit more worried by

 options(digits=1)
 plot(seq(50.2,50.5,0.1))

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=