[R] lattice shingle plot axis annotation

Armin Goralczyk agoralczyk at gmail.com
Thu Jul 30 09:43:58 CEST 2009


Hello (R-)Experts

I hope someone can help with this problem concerning axis annotation
of a lattice shingle plot. I want a plot with three shingles to
display some laboratory value over time. In the first panel over the
first few days, then in the next panel some months, and in the last
panel some years. In the following minimal example the axis annotation
will be in days, but I'd like to have days in the fisrt panel, months
in the second panel and years in the third panel. Is it possible?

pod <- seq(1, 5000, 5)
test <- data.frame(pod=pod,
                   val=rep(c(1,2,4,8), length=length(pod)),
                   g=rep(c('A', 'B'), length=length(pod)))
shingle.pod <- shingle(test$pod, intervals = rbind(c(0, 20), c(20, 180),
                                c(220, 6000)))
test.plot <- xyplot(val ~ pod | shingle.pod,
                    data = test,
                    groups = test$g,
                    scales = list(x = "free",
                    y = list(relation = "same", log = 2)),
                    between = list(x = 0.5),
                    panel = function(x, y, ...) {
                        panel.grid(h = -1, v = -1, lwd = 1)
                        panel.superpose(x, y, ...)
                    },
                    type = c('b')
                    )
plot(test.plot)

(this plot doesn't look good, I know, it's just and example)
Thank you
-- 
Armin Goralczyk
--
http://www.gwdg.de/~agoralc




More information about the R-help mailing list