Dear R users,
Using xyplot(), how can I position the key in the *margin* outside the
plotting area ?
My problem is that the key always overlaps with the x axis labels, no
matter how I try to specify any of the par() arguments (e.g. oma()).
Many thanks for any suggestions!
Christoph
###
for information, here??s the code I use
par(oma=c(0,0,3,0)) ###this, I think, is what should be changed
xyplot(jitter(height,factor=1) ~ sowndiv | time2,
groups=treatment, data=caging04051, subscripts=T,
xlab=list("Diversity",cex=1.5),
ylab=list("Height",cex=1.5),
layout=c(3, 1),
key=list(space="top",border=TRUE,
columns=1,
transparent=FALSE,
points=list(pch=c(1,2),cex=2),
lines=list(col=c(1,1), lty=c(1,2), lwd=c(1.5,1.5)),
text=list(levels(treatment), cex=1.2)),
par.strip.text=list(cex=1.2),
strip = function(..., strip.names)
strip.default(..., strip.names=c(FALSE, TRUE),
style = 1),
scales=list( x=list(at=c(1, 2, 4, 8, 16, 60),
labels=c(1,2,4,8,16,60),log=TRUE,cex=1.4,tck=0.02),
y=list(tck=0.02)),
panel=function(x, y, subscripts, groups){
panel.superpose(x, y, subscripts, groups,cex=1.4)
which <- groups[subscripts]
panel.loess(x[which=="C"],y[which=="C"],lty=1)
panel.loess(x[which=="H"],y[which=="H"],lty=2)
})
On 11/9/05, Christoph Scherber <Christoph.Scherber at uni-jena.de> wrote:> Dear R users, > > Using xyplot(), how can I position the key in the *margin* outside the > plotting area ? > > My problem is that the key always overlaps with the x axis labels, no > matter how I try to specify any of the par() arguments (e.g. oma()).Evidently that doesn't happen regularly, or someone would have noticed by now. In other words, there's something specific to your example that's causing it. Unless you give us a reproducible example, preferably with all the irrelevant junk edited out, I don't see how we can help.> ### > for information, here??s the code I use > > par(oma=c(0,0,3,0)) ###this, I think, is what should be changed?lattice has the following note: Lattice plots are highly customizable via user-modifiable settings. However, these are completely unrelated to base graphics settings; in particular, changing 'par()' settings usually have no effect on lattice plots. -Deepayan