Wednesday, January 30, 2013

R boxplot side by side


png('out.png')
boxplot(sample(100), at=1, xlim=c(0,3))
boxplot(sample(20), at=2, add=T)
dev.off()

The key here is to set

xlim=c(0,3)

and set the positions with

at=1
at=2

and set

add=T

to the second boxplot.

No comments: