[R] Plotting on log scale using plot.date()

Roger Peng rpeng at stat.ucla.edu
Thu Feb 7 17:39:12 CET 2002


Hi, I'm trying to use the date library and I think I'm getting an
incorrect warning when I make a plot with plot.date().  For example:

> library(date)
> x <- as.date(1:100)
> y <- 1:100
> plot(x, y, log = "y")
Warning message: 
parameter "log" couldn't be set in high-level plot() function 

The problem appears to be in the last line of plot.date() function where
the x-axis is being created.  There is a call to axis() and the log = "y"
parameter is being passed.

I noticed a similar-sounding bug in the bugs repository (#1235) but I
don't think it's related. 

Here's the code for plot.date().  I think problem is at the end.

plot.date
function (x, y, ..., axes, xaxt, xlab, ylab, xlim = range(x, 
    na.rm = TRUE), ylim = range(y, na.rm = TRUE)) 
{
    [ ... some code ... ]
    else {
        plot(x, y, ..., xaxt = "n", xlab = xlab, ylab = ylab, 
            xlim = xlim, ylim = ylim)
        x <- c(x[!is.na(x)], xlim)
        xd <- date.mdy(x)
        temp <- pretty(x, n = par("lab")[1])
        delta <- temp[2] - temp[1]
        if (delta < 1) 
            temp <- seq(min(x), max(x), 1)
        else if (delta > 182) {
            temp <- xd$year + (x - mdy.date(1, 1, xd$year))/365
            temp <- pretty(temp, n = par("lab")[1])
            temp <- mdy.date(1, 1, floor(temp)) + floor((temp%%1) * 
                365)
        }
        axis(1, temp, as.character.date(temp), ...)
    }
}

Should ... be passed to axis?

Thanks!


platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    4.1              
year     2002             
month    01               
day      30               
language R              

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list