Skip to content

lattice key in blank panel

2 messages · Max Kuhn, Deepayan Sarkar

#
Somewhere I've seen an example of an xyplot() where the key was placed
in a location of a missing panel. For example, if there were 3
conditioning levels, the panel grid would look like:

34
12

In this (possibly imaginary) example, there were scatter plots in
locations 1:3 and location 4 had no conditioning bar at the top, only
the key.

I can find examples of putting the legend outside of the panel
locations (e.g to the right of locations 2 and 4 above), but that's
not really what I'd like to do.

Thanks,

Max
#
On Fri, Dec 16, 2011 at 1:22 AM, Max Kuhn <mxkuhn at gmail.com> wrote:
You are probably thinking of this example from ?splom:

splom(~iris[1:3]|Species, data = iris,
      layout=c(2,2), pscales = 0,
      varnames = c("Sepal\nLength", "Sepal\nWidth", "Petal\nLength"),
      page = function(...) {
          ltext(x = seq(.6, .8, length.out = 4),
                y = seq(.9, .6, length.out = 4),
                labels = c("Three", "Varieties", "of", "Iris"),
                cex = 2)
      })

It's actually easier to do that with legends, as illustrated by this
(somewhat silly) modification:

splom(~iris[1:3]|Species, data = iris, groups = Species,
      layout=c(2,2), pscales = 0,
      varnames = c("Sepal\nLength", "Sepal\nWidth", "Petal\nLength"),
      auto.key = list(x = 0.75, y = 0.75, corner = c(0.5, 0.5)))

-Deepayan