dd <- data.frame(
x=c(1,2,1,2,3,1,2,1,2,3),
y=c(2,2,2,2,2,1,1,1,1,1),
loc=factor(c(1,1,2,2,2,1,1,2,2,2)),
rep=factor(c(2,2,1,2,3,1,1,1,2,3)))
library(ggplot2)
ggplot(dd, aes(x=x, y=y)) +
facet_wrap( ~ loc) +
geom_tile(aes(fill=rep)) +
geom_tileborder(aes(group=1, grp=rep), lwd=1.5)
# Compare to lattice version of desplot
# desplot::desplot(rep ~ x*y|loc, data=dd, out1=rep)
Run the code above in your browser using DataLab