I'm trying to put text outside of a graphical legend using lattice, but it's proving a pain. It's a scatterplot that is sorted along a coloured scale by another variable. The legend appears fine, but unfortunately it doesn't have a text label (the easiest part). I've tried title (for legend), text, Mtext, panel.text which only puts the text within the panel. Furthermore, everywhere I try and put label or text within the legend code doesn't seem to work.
xyplot(calcona$Mid.depth ~ calcona$bits,
data=calcona, groups = color, col="black",
panel = function (x, y, groups, ..., subscripts)
{
fill<-groups[subscripts]
panel.grid(h=-1, v=-1)
panel.xyplot(x, y, pch=21, fill=fill, ...)
},
legend=
list(right= #I believe the code needs to go here somewhere.
list(title="text here doesn't work", fun=draw.colorkey,
args=list(key=list(col=heat.colors,
at = caex.breaks),
draw=FALSE))),
ylim=(rev(range(0:100))),
xlim = range(0:7), ylab = "Depth (cm)",
xlab = "SEM (%)",
main = list( label =
"SEM", cex=1))