[R] two lattice graphs in one object

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Sep 3 23:44:32 CEST 2008


On Tue, Sep 2, 2008 at 11:43 PM, Andreas Krause <andreas at elmo.ch> wrote:
> Deepayan,
>
> that is exactly what I was hoping for. Thanks much!
>
> Experimenting with it I noticed that updating two existing objects with plot arguments seems to not work, at least not in this way:
>
> gr1 <-xyplot(rnorm(111) ~ runif(111), main = "Plot A")
> gr2 <- xyplot(runif(111) ~ runif(111), main = "Plot B")
>
> plist <- list(
>  update(gr1, plot.args = list(position = c(0, 0, 1, 0.5), more = TRUE)),
>  update(gr2, plot.args = list(position = c(0, 0.5, 1, 1), more = FALSE))
> )
>
> print(plist)
> gives me two separate pages, even though the object is updated:
>
>> plist[[1]]$panel.args.common
> $plot.args
> $plot.args$position
> [1] 0.0 0.0 1.0 0.5
>
> $plot.args$more
> [1] TRUE
>
> I can get it to work the "dirty" way:
> plist[[1]]$plot.args <-  list(position = c(0, 0, 1, 0.5), more = TRUE)
> plist[[2]]$plot.args <-  list(position = c(0, 0.5, 1, 1), more = FALSE)
>
> Shouldn't update work as well?

Yes, it should; but update() predates 'plot.args' etc. and wasn't
updated; it treats 'plot.args' as an unrecognized argument and adds it
to the list of panel function arguments. I'll fix this in the next
release.

-Deepayan



More information about the R-help mailing list