[Rd] plot(x) in 2.7.0 (with y=NULL) proposed code correction

Martin Maechler maechler at stat.math.ethz.ch
Wed Apr 23 09:00:11 CEST 2008


Thank you, Bill, (and Gabor BTW) for the nice example.

In the mean time the change has made it into R-patched aka 
'R 2.7.0 patched' , not only in SVN but also already in last night's
snapshot at ftp://stat.ethz.ch/Software/R/

Martin

    BD> On Tue, 22 Apr 2008, Martin Maechler wrote:
    BD> I've committed my proposal, and am interested in feedback,
    BD> notably additional relevant examples.

    BD> I tried the following test and the axes
    BD> looked right in 2.6.2 and the r45453
    BD> (right after your change to plot.R).
    BD> They looked bad (all were 2,4,6,8,10, not
    BD> 1*pi,2*pi,3*pi) in r45390 (2008-04-19).


    >> Axis.MyRadian <- function(x = NULL, at = NULL, ...,
    >>     side, labels = NULL)
    >> {
    >>     r <- range(x)
    >>     npi <- floor(r[1]/pi):ceiling(r[2]/pi)
    >>     at <- npi * pi
    >>     labels <- as.expression(lapply(
    >>         npi,function(i)substitute(i*pi, list(i=i))))
    >>     axis(side=side, at=at, labels=labels)
    >> }
    >> par(mfrow=c(2,2))
    >> plot(structure(1:10, class="MyRadian"), sin(1:10),
    >>    main="n pi radians on x  axis")
    >> plot(structure(1:10, class="MyRadian"),
    >>    main="n pi radians on y axis")
    >> plot(structure(1:10, class="MyRadian"),
    >>    structure(10:1, class="MyRadian"),
    >>    main="n pi radians on both axes")
    >> plot(1:10, 1:10, main="no pi's on either axis")
    >> par(mfrow=c(2,2))
    >> 
    >> 
    >> ----------------------------------------------------------------------------
    >> Bill Dunlap
    >> Insightful Corporation
    >> bill at insightful dot com
    >> 360-428-8146
    >> 
    >>  "All statements in this message represent the opinions of the author and do
    >>  not necessarily reflect Insightful Corporation policy or position."



More information about the R-devel mailing list