[英]Multiple boxplots in one in R
Hi I need to plot a boxplot in R. I have two matrices a and b. 嗨,我需要在R中绘制一个箱形图。我有两个矩阵a和b。 I created a boxplot for
a
and want to create boxplot for b
on the same plot for a
. 我为
a
创建了一个boxplot,并希望在同a
图上为b
创建b
boxplot。 The boxplots of the b
matrix should lie on the whiskers of the boxplot for a
. 所述的箱图
b
矩阵应该位于箱线图的对晶须a
。
Is there a way I can do it in R ?? 有没有办法可以在R ??
To add a boxplot to an existing plot, just use the argument add=TRUE
, viz: 要将Boxplot添加到现有绘图中,只需使用参数
add=TRUE
,即:
##Some data
a = rnorm(20)
b = rnorm(20, 2, 0.3)
##The plots
boxplot(a)
boxplot(b, add=TRUE, col=2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.