Skip to content
Prev 106232 / 398506 Next

xyplot: legend title + legend on 1 line

On 12/15/06, RMan54 <RMan54 at cox.net> wrote:
You can create a grob (grid object) representing this legend, or a
function that produces such a grob, and pass it to xyplot through the
'legend' argument (see ?xyplot). The 'key' argument essentially
controls one such built-in function, namely 'draw.key', which does not
support such legends.

Note however, that column types can be repeated in key, so you might
be able to fake such a legend. E.g.:


xyplot(1 ~ 1,
       key =
       list(text = list("title: ", font = 2),
            points = list(pch = 1),
            text = list("1"),
            points = list(pch = 2),
            text = list("2")))

-Deepayan