[R] Key titles in Lattice

From: Kuhn, Max <Max.Kuhn_at_pfizer.com>
Date: Fri 02 Jun 2006 - 05:32:44 EST


I'm creating some lattice plots that have a key and I'd like to put a label on the key. The problem is that the text label for the key prevents the values of the group variables from being shown (see example below). I don't think that this is a feature, but I might be abusing the title arg for key.

I'm using R Version 2.3.0 (2006-04-24) on Windows XP and lattice V0.13-8



testData <- expand.grid(

   A = letters[1:2], 
   B = letters[3:4], 
   C = letters[5:6])

testData$y <- rnorm(dim(testData)[1])


   y ~ A|B, data = testData,
   groups = C,
   panel = function(x, y, groups, subscripts)    {

      group.values <- sort(unique(groups))
      for (i in seq(along=group.values)) 
         id <- (groups[subscripts] == group.values[i])
         current.val <- group.values[i]
         panel.stripplot(x[id], y[id],
            jitter.data = FALSE, horizontal = FALSE,
            col = trellis.par.get()$superpose.symbol$col[i], 
            pch = trellis.par.get()$superpose.symbol$pch[i])
            x[id], y[id], horizontal=F,
            col = trellis.par.get()$superpose.symbol$col[i], 
            lty = trellis.par.get()$superpose.line$lty[i], 
            lwd = trellis.par.get()$superpose.line$lwd[i])

   main = "Some Text",
   key = list(
      columns = 2,

# comment the next line out to see
# the values of the grouping variable
         title = "More Text",  
         lab = letters[5:6]),
         col = trellis.par.get()$superpose.symbol$col[1:2],
         lwd = trellis.par.get()$superpose.line$lwd[1:2],
         lty = trellis.par.get()$superpose.line$lty[1:2]),
      points = list(
         col = trellis.par.get()$superpose.symbol$col[1:2],
         pch = trellis.par.get()$superpose.symbol$pch[1:2]))) 

LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 02 05:40:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 02 Jun 2006 - 08:10:46 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.