简体   繁体   中英

Multiple boxplots in one in R

Hi I need to plot a boxplot in R. I have two matrices a and b. I created a boxplot for a and want to create boxplot for b on the same plot for a . The boxplots of the b matrix should lie on the whiskers of the boxplot for a .

Is there a way I can do it in R ??

To add a boxplot to an existing plot, just use the argument add=TRUE , viz:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM