Skip to content
Prev 317503 / 398503 Next

Plotting multiple xyplots in same page

Hi Lisa

You can use the page function of xyplot to do this

xy <-
xyplot(decrease ~ treatment, OrchardSprays,
        groups = rowpos, type = "a",
            page     = function(n){
                         grid.text(LETTERS[j],
                         y = 0.95,
                         x = 0.01,
                         default.units = "npc",
                         just = c("left"),
                         gp = gpar(fontsize = 12) )
                       },
        auto.key = list(x = 0.2, y = 0.9,
        cex = 0.75, points = FALSE, lines = TRUE))

j = 1
print(xy, pos = c(0.0, 0.0, 0.5, 0.5), more = TRUE)
j = j+1
print(xy, pos = c(0.0, 0.5, 0.5, 1.0), more = TRUE)
j = j+1
print(xy, pos = c(0.5, 0.0, 1.0, 0.5), more = TRUE)
j = j+1
print(xy, pos = c(0.5, 0.5, 1.0, 1.0), more = FALSE)

amend x, y  and grid::gp positions/values to suit

There are other ways using trellis.focus and the package grid

HTH

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 08:28 14/02/2013, you wrote: