[R] skipping rows in trellis key
Steven Lacey
slacey at umich.edu
Thu Apr 6 19:25:31 CEST 2006
Deepayan,
I also noticed that the width of the key object is off if the title of the
key is bigger than the columns. For example,
xyplot(y~x,data=data.frame(x=1:10,y=1:10))
keyArgs <- list()
keyArgs <- list(points=list(pch=c(NA,rep(17,5)),lwd=2,col=c(NA,c("red",
"chartreuse3", "black", "cyan", "blue"))),
text=list(lab=c("S-R Mapping",
"Color","Shape","Letter","Compatible","Incompatible"),cex=c(1.2,1,1,1,1,1)),
text=list(lab=c(expression(R^2),as.character(rep(0.999,5))),cex=c(1.2,1,1,1,
1,1)))
keyArgs$title <- "try this very, very, very long title"
keyArgs$cex.title <- 1.4
keyArgs$between <- c(1,0,5)
keyArgs$columns <- 1
keyArgs$column.between <- 1
keyArgs$border <- TRUE
drawKeyArgs <- list(key=keyArgs,draw=FALSE)
keyArgs$draw <- FALSE
key <- do.call("draw.key",drawKeyArgs)
vp1<-viewport(x=1,y=1,height=unit(1,"grobheight",key),width=unit(1,"grobwidt
h",key),just=c("right","top"))
pushViewport(vp1)
grid.draw(key)
popViewport()
What is a good work around?
Thanks,
Steve
-----Original Message-----
From: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com]
Sent: Thursday, April 06, 2006 12:32 PM
To: Steven Lacey
Cc: r-help at stat.math.ethz.ch
Subject: Re: skipping rows in trellis key
On 4/5/06, Steven Lacey <slacey at umich.edu> wrote:
> Try this...
>
> xyplot(y~x,data=data.frame(x=1:10,y=1:10))
> keyArgs <- list()
> keyArgs <-
> list(points=list(pch=c(NA,rep(17,5)),lwd=2,col=c(NA,c("red",
> "chartreuse3", "black", "cyan", "blue"))),
> text=list(lab=c("S-R Mapping",
>
"Color","Shape","Letter","Compatible","Incompatible"),cex=c(1.2,1,1,1,1,1)),
>
> text=list(lab=c(expression(R^2),as.character(rep(0.999,5))),cex=c(1.2,
> 1,1,1,
> 1,1)))
> keyArgs$between <- c(1,0,5)
> keyArgs$columns <- 1
> keyArgs$column.between <- 1
> keyArgs$border <- TRUE
> drawKeyArgs <- list(key=keyArgs,draw=FALSE)
> keyArgs$draw <- FALSE
> key <- do.call("draw.key",drawKeyArgs)
>
vp1<-viewport(x=1,y=1,height=unit(1,"grobheight",key),width=unit(1,"grobwidt
> h",key),just=c("right","top"))
> pushViewport(vp1)
> grid.draw(key)
> popViewport()
Hmm. I'll add a component called 'padding.text' in R 2.3.0 which can be used
to control the padding around text rows.
Deepayan
More information about the R-help
mailing list