Hi Elliot
This works on Win 7 ver 2.15
useOuterStrips(combineLimits(
xyplot(x + y ~ d | g, groups = h, data = dat, type = 'l',
scales = list(y = list(relation = "free"),
x = list( at =seq(from =
as.Date("2011-01-01"), to = as.Date("2011-10-01"), by =
"3 month"),
labels = format(seq(from =
as.Date("2011-01-01"), to = as.Date("2011-10-01"), by =
"3 month"), "%b"))
),
auto.key = TRUE) ))
amend the seq as required and the format if required
see ?strptime for format
HTH
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 02:28 26/06/2012, you wrote:>I'm having some trouble using the latticeExtra 'combineLimits'
function
>with a Date x-variable:
>
>require(lattice)
>
>set.seed(12345)
>
>dates <- seq(as.Date("2011-01-01"),
as.Date("2011-12-31"), "days")
>dat <- data.frame(d = rep(dates, 4),
> g = factor(rep(rep(c(1,2), each = length(dates)), 2)),
> h = factor(rep(c("a", "b"), each =
length(dates)*2)),
> x = rnorm(4 * length(dates)),
> y = rnorm(4 * length(dates)))
>
>plt1 <- xyplot(x + y ~ d | g, groups = h, data = dat, type = 'l',
scales >list(relation = "free"),
> auto.key = TRUE)
>plt1 <- useOuterStrips(plt1)
>plt1 <- combineLimits(plt1)
>
>The x-axis labels are right after the call to 'useOuterStrips' but
they get
>converted to numeric after the call to 'combineLimits'. How do I
keep them
>as date labels?
>
>Thanks.
>
>- Elliot
>
>--
>Elliot Joel Bernstein, Ph.D. | Research Associate | FDO Partners, LLC
>134 Mount Auburn Street | Cambridge, MA | 02138
>Phone: (617) 503-4619 | Email: elliot.bernstein at fdopartners.com
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.