I am trying to obtain multiple legends on a densityplot, using the legend parameter. I am trying the following code, with just one legend at the moment, which doesn't work. I get Error in valid.data(rep(units, length.out = length(x)), data) : No 'grob' supplied for 'grobwidth' unit Fixable or better method ? What I need is a separate legend for each panel. densityplot(~lclassprob | cov, groups=group, main='Density Plot for Covariates', xlab='Class probability (Logistic)', plot.points=FALSE, layout=c(1,6), legend=list(inside=list(corner=c(0,0),x=0, y=0, fun=simpleKey, args=list(text= c("Yes","No"), points = FALSE, rectangles = FALSE, lines = TRUE))), data=newcapsCov2)