Dear S-users,
I have a hard time finding a solution to the following problem. I have
this function which, among others things, creates and print a trellis
plot created with xyplot. Different data.frame objects are sent to this
function along with others variables. Everything would be fine if only
the legend of my plot was not displayed on top of my X-axis title (see
sample script below). Is there a way to increase the margin for the
key, or should I specify the key differently?
Thanks in advance for your advises.
myfcn <- function(mydf){
assign("mydf",mydf,frame=1)
myplot<-xyplot(b~a|ID,
data=""
panel=function(x,y,subscripts){
panel.xyplot(x, y, pch=16)
panel.xyplot(mydf$a[subscripts],mydf$c[subscripts],pch=3)
},
as.table=T,
subscripts=T,
key = list(space="bottom",
transparent = T,
text=list(c("b", "c")),
lines = list(pch = c(16,3), type = c("p", "p"))),
)
print(myplot)
}
a <- rep((1:10),times=2)
b <- rep((11:20),times=2)
c <- rep((20:11),times=2)
ID<- rep((1:4), each =5)
mydf<-data.frame(a,b,c,ID)
myfcn(mydf)
|
|