[R] Key titles in Lattice
Kuhn, Max
Max.Kuhn at pfizer.com
Thu Jun 1 22:20:53 CEST 2006
Peter and Sundar,
Thanks, I did miss that. I used:
key = list(
title = "More Text",
cex.title = 1,
columns = 2,
text=list(
to get what I wanted.
Max
-----Original Message-----
From: P Ehlers [mailto:ehlers at math.ucalgary.ca]
Sent: Thursday, June 01, 2006 4:14 PM
To: Kuhn, Max
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Key titles in Lattice
Hi Max,
You have 'title' as a component of the 'text' component of key.
According to the help page for xyplot, 'title' is a component
of key. AFAICS, 'text' does not have a 'title' component.
Peter Ehlers
Kuhn, Max wrote:
> Hi,
>
> 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
>
> Thanks,
>
> Max
>
>
> library(lattice)
> testData <- expand.grid(
> A = letters[1:2],
> B = letters[3:4],
> C = letters[5:6])
> testData$y <- rnorm(dim(testData)[1])
>
> stripplot(
> 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])
> panel.linejoin(
> 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,
> text=list(
> # comment the next line out to see
> # the values of the grouping variable
> title = "More Text",
> lab = letters[5:6]),
> lines=list(
> 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 at 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
----------------------------------------------------------------------
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
More information about the R-help
mailing list