Re: [R] multiple groups with different colors in boxplot

2009-10-13 Thread Henrique Dallazuanna
Try this; DF <- as.data.frame(matrix(rnorm(60), 10)) boxplot(DF, col = rep(seq(ncol(DF)) + 1, each = 2)) On Tue, Oct 13, 2009 at 2:11 AM, kennyPA wrote: > > Can anybody help me on how to boxplot multiple groups with different color? > Say, I have 3 groups of data, each group with 2 boxes, and I'

Re: [R] multiple groups with different colors in boxplot

2009-10-13 Thread ONKELINX, Thierry
Here is a solution using ggplot2 n <- 1000 dataset <- data.frame(A = rep(1:6, n), B = rep(gl(3, 2), n)) dataset$C <- with(dataset, rnorm(n) * as.numeric(B) + A) library(ggplot2) dataset$A <- factor(dataset$A) #with default colours ggplot(dataset, aes(x = A, y = C, colour = B)) + geom_boxplot() #wi