[R] arranging multiple lattice graphs on a page

Christopher W. Ryan cry@n @end|ng |rom b|ngh@mton@edu
Thu Apr 2 23:23:22 CEST 2020


I would like to place two separate plots, one above the other, something
like this (MWE for illustration):

library(lattice)
data(iris)
layout(matrix(c(1,2), 2, 1, byrow = TRUE))
with(iris, (plot(Sepal.Length ~ Petal.Length)))
with(iris, (plot(Sepal.Length ~ Petal.Width)))

but with lattice, so one of the plots can have panels. So something like
this:

library(lattice)
data(iris)
layout(matrix(c(1,2), 2, 1, byrow = TRUE))
xyplot(Sepal.Length ~ Petal.Length, data = iris)
xyplot(Sepal.Length ~ Petal.Width | Species, data = iris, layout = c(3,1))

But the latter does not accomplish my goal. Appreciate any advice.

Thanks.

--Chris Ryan
SUNY Upstate Medical University
Binghamton, NY



More information about the R-help mailing list