Wednesday, January 30, 2013

R boxplot with scatter points overlayed


png('out.png')
boxplot(sample(10,100,replace=T))
points(pch=21,cex=1.5,bg='red',sample(10,10,replace=T)~rep(1,10))
dev.off()

The keypoint here is this part

~rep(1,10)

So you need to associate a factor with your points!

No comments: