On Tue, Mar 23, 2010 at 4:28 AM, Nick Ackerman <nick.acker...@pgn.com> wrote: > > Hi, > > I have a plot that is essentially the same as that in Figure 5.6 of "Lattice > - Multivariate Data Visualization with R". The key difference is that I > would like to add a title to top of the grey color spectrum legend, but have > thus far been unsuccessful. I've tried a variety of options, but to no > avail. I'm new to R, and admittedly I don't understand the "legend" argument > that well, and in this case how it interacts with the "key" argument. Thanks > in advance for any help. For reference, here is the code to Figure 5.6.
draw.colorkey() doesn't support a title for the legend. The easiest alternative is to place the legend on top and add a main title: xyplot(lat ~ long | Magnitude, data = quakes.ordered, aspect = "iso", groups = color, cex = 2, 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(top = list(fun = draw.colorkey, args = list(key = list(space = "top", col = gray.colors, at = depth.breaks), draw = FALSE))), xlab = "Longitude", ylab = "Latitude", main = "Main title") -Deepayan ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.