Dear R gurus,
A re-post due to suggestions from moderators.....
Thanks to tips from Gabor and Felix, I was able to make some progress.. How
do I control the position of panel.text? I would like the text appear at a
specific position (say, top right corner) inside a panel.
Below is the sample code...
d=data.frame(x=rep(sample(1:5,rep=F),10),y=rnorm(50),z=rep(sample(LETTERS[1:2],rep=F),25))
xyplot(y ~ x, data = d, groups = z,subscripts=T,
panel = panel.superpose,
panel.groups = function(x=x,y=y,subscriptssubscripts,..., group.number) {
require(grid)
panel.xyplot(x=x,y=y,subscripts=subscripts,...)
span <- switch(group.number, 2/3, 1/4, 1/2)
panel.loess(x=x,y=y,subscripts=subscripts,..., span = span)
panel.text(x=max(x),y=max(y),lab=paste(round(cor(x,y),2)),col=trellis.par.get("superpose.symbol")$col[group.number])
}, auto.key = list(lines = TRUE,space="right"))
Thanks a TON!!
Santosh
[[alternative HTML version deleted]]