Skip to content
Prev 366308 / 398502 Next

How to overlay lines and rectangles in lattice plot key

I think the intended appearance is closer to this

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width,
  iris,
  type = c("p", "r"),
  jitter.x = TRUE,
  jitter.y = TRUE,
  factor = 5,
  key = list(between=c(-4.5),
    column=4,
    text=list(lab=paste0("       ", letters[1:4], "           ")),
    lines=list(col=1:4, pch=1:4, type='b'),
    rectangles=list(col=1:4, alpha=0.25, border=FALSE)
  )
)

I have the partial overlap of the rectangles and the line-point objects.
They don't align correctly.  I think even more complex grid usage is needed than
Duncan provided.

Rich
On Thu, Dec 29, 2016 at 12:16 AM, Duncan Mackay <dulcalma at bigpond.com> wrote: