This question is duplicated, but I'm trying to add a lattice solution. I found that there is no need to customize panel panels. Maybe I missed something, but here is my code:
library(lattice) xyplot(error~buckets|dim, groups=is.init,data=dat,type='l', auto.key=list(columns = 2), strip = function(which.panel,var.name,factor.levels,...) { strip.default(..., which.panel,factor.levels, var.name = paste0(var.name,factor.levels[which.panel])) })

source share