Skip to content
Back to formatted view

Raw Message

Message-ID: <ulgptn3rebn.fsf@phz.com>
Date: 2003-04-30T19:10:52Z
From: Ed Kademan
Subject: ylab in plot.POSIXct

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.