Example:

boxplot(d1$b ~ d1$a, pars = list(boxwex = 0.15), at=c(1:3 - 0.1), xaxt="n")
boxplot(d2$b ~ d2$a, add=T, pars = list(boxwex = 0.15), at=c(1:3 + 0.1), xaxt="n")
axis(1, at=1:3)

Uwe

Malcolm Ryan wrote:
Is there any way to get a boxplot of several data sets beside one another on the same graph, as there is for barplot?

If I do:

d1 <- data.frame(a = c(rep(1:3, each = 3)), b = c(1:9))
d2 <- data.frame(a = c(rep(1:3, each = 3)), b = c(9:1))
boxplot(d1$b ~ d1$a)
boxplot(d2$b ~ d2$a, add=T)

It will show the two datasets on the one graph, but the middle point will overlap.

What I want is a layout more like:

barplot(t(matrix(c(d1$b, d2$b), ncol=2)), beside=T)

only showing the boxes from the plot above instead of bars.

Can this be done?

Malcolm

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to