Skip to content

Creating a scatterplot with sequential dates on x-axis?

3 messages · Caitlin Gibbons, Joshua Wiley, Duncan Mackay

#
Hi Caitlin,

Here are a couple of options for you:

plot(x = seq(from = as.Date("2011-05-01"), to = as.Date("2011-05-30"),
by = "day"),
     y = cumsum(runif(30)))

## using a bit of a shortcut
plot(x = as.Date("2011-05-01") + 0:29,
     y = cumsum(runif(30)))

Does that do what you want?

Josh
On Sun, Aug 7, 2011 at 5:00 PM, Caitlin <bioprogrammer at gmail.com> wrote:

  
    
#
Try
library(lattice)
x = seq(from = as.Date("2011-01-01"), by = "1 month", length = 10)
y = rnorm(10)
xyplot(y~x)
?xyplot
?seq

Regards

Duncan


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au
At 10:00 08/08/2011, you wrote: