R-0.99.0a now plots contour labels from contour(), but the values in levels seem to be coerced to integer. Reproduce by:> set.seed(2) > contour(matrix(runif(36),nrow=6), labcex=1.2)and compare with:> set.seed(2) > contour(matrix(10*runif(36),nrow=6), labcex=1.2)Ray Brownrigg -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 16 Feb 2000 Ray.Brownrigg@mcs.vuw.ac.nz wrote:> R-0.99.0a now plots contour labels from contour(), but the values in > levels seem to be coerced to integer. > > Reproduce by: > > set.seed(2) > > contour(matrix(runif(36),nrow=6), labcex=1.2) > > and compare with: > > set.seed(2) > > contour(matrix(10*runif(36),nrow=6), labcex=1.2) >The code has (plot3d.c, ca line 718) /* Need to send labels in from interpreted R code ? */ sprintf(buffer, " %.00f ", zc); so, yes, it is printed as an integer, and the comment there is right. I guess the labels should be format(levels) by default, to ensure that the use of trailing zeros is consistent, but it should be in R code so users can override the default precision, say. -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> The code has (plot3d.c, ca line 718) > > /* Need to send labels in from interpreted R code ? */ > sprintf(buffer, " %.00f ", zc); > > so, yes, it is printed as an integer, and the comment there is right. > I guess the labels should be format(levels) by default, to ensure that > the use of trailing zeros is consistent, but it should be in R code > so users can override the default precision, say. >Thanks for finding the relevant piece of code. I did look, but wasn't au fait enough with C or the R way of doing things to spot the relevant piece. How about replacing: sprintf(buffer, " %.00f ", zc); by: sprintf(buffer, " %.9g ", zc); It seems to do what I want, and not behave any differently from before for integer contour lines. Regards Ray Brownrigg -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._