Displaying 1 result from an estimated 1 matches for "pnlid".
Did you mean:
plid
2011 Jan 25
1
lattice draw.key(): position of key in panels
...de a panel function. As a result,
the legend is placed in the middle of the panel. The example below
illustrates this problem.
df <- data.frame(x=c(1,1),y=c(1,2),type=c("A","B"))
panel.xyplot.x <- function(...) {
# draw data
panel.xyplot(...)
# create key-list
pnlid <- panel.number()
lbl <- ifelse(pnlid==1,"AA","BB")
pts <- Rows(trellis.par.get("superpose.symbol"),pnlid)
key <- list(points=pts,text=list(lbl),x=0.1,y=0.9,corner=c(0,1))
# draw key
draw.key(key,draw=TRUE)
}
oltc <- xyplot(y~x|type,data=df,p...