data(rinse)
dev.new()
boxplot(score ~ time, data=subset(rinse,rinse=="Placebo"),ylim=c(0,3.5),
at=c(1:3)-0.2, col="yellow", xaxt="n", boxwex=0.15)
boxplot(score ~ time, data=subset(rinse,rinse=="A"), add=TRUE,
at=c(1:3), col="gray", xaxt="n", boxwex=0.15)
boxplot(score ~ time, data=subset(rinse,rinse=="B"), add=TRUE,
at=c(1:3) + 0.2, col="blue", xaxt="n", boxwex=0.15)
axis(1, at=c(1:3), labels=unique(rinse$time))
legend("bottomleft",legend=c("placebo","rinse A","rinse B"),
title="Treatment",fill=c("yellow","gray","blue"),bty="n")
Run the code above in your browser using DataLab