I want to create boxplots in R for each row of A and B (two matrices). I want to have them both in the same plot because they share same x-axis.
Here is my Data (each matrix has 20 rows, 5 columns)
A <- matrix( rnorm(100), ncol = 5 )
B <- matrix( rnorm(100), ncol = 5 )
For each row I want to have a boxplot. To create the boxplots for each matrix (row-wise, based on How to boxplot row-wise matrix in R? ) I can use:
boxplot(A, use.cols = F, col="red")
boxplot(B, use.cols = F, col="green")
I have tried this but the boxplots are not side by side (overlapping):
boxplot(A, use.cols = F, col="red")
par(new=TRUE)
boxplot(B, use.cols = F, col="green")
Any suggestions? Thanks.