[R] ylab in plot.POSIXct
    Ed Kademan 
    kademan at phz.com
       
    Wed Apr 30 21:10:52 CEST 2003
    
    
  
I am using R-1.7.0 and have some data which consist of one vector of
numbers and a second corresponding vector of dates belonging to the
POSIXct class.  I would like to plot the numbers against the dates.
What is the best way to do this?
It almost works to just call `plot.'  However if I do this while using
the `ylab' parameter I get a warning message:
  parameter "ylab" couldn't be set in high-level plot() function 
Here is a function that demonstrates the behavior.
  ylabProblem <- function() {
    x <- ISOdate(2003, 4, 1:10)           # POSIXct vector
    y <- rnorm(10)
    plot(x, y, ylab = 'I am y')
  }
It works to invoke the low-level plotting routines by hand as follows:
  ylabNoProblem <- function() {
    x <- ISOdate(2003, 4, 1:10)           # POSIXct vector
    y <- rnorm(10)
    plot.default(x, y, xaxt = 'n', xlab = '', ylab = 'I am y')
    axis.POSIXct(1, x)
  }
But I don't like calling methods explicitly like this.
    
    
More information about the R-help
mailing list