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

Bill Dunlap bill at insightful.com
Tue Apr 22 22:15:17 CEST 2008


On Tue, 22 Apr 2008, Martin Maechler wrote:

> I've committed my proposal, and am interested in feedback,
> notably additional relevant examples.

I tried the following test and the axes
looked right in 2.6.2 and the r45453
(right after your change to plot.R).
They looked bad (all were 2,4,6,8,10, not
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