Several boxes in one of the R

Hi I need to plot a rectangle in R. I have two matrices a and b. I have created a boxplot for a

and want to create a boxplot for b

on the same plot for a

. Matrix boxes b

must lie on the mustache boxplot for a

.

Is there a way to do this in R ??

+3


source to share


1 answer


To add a rectangle to an existing plot, just use an argument add=TRUE

, namely:



##Some data
a = rnorm(20)
b = rnorm(20, 2, 0.3)

##The plots
boxplot(a)
boxplot(b, add=TRUE, col=2)

      

+8


source







All Articles