我用下面的code产生多个箱图,通过变量的平均值排名:
I use the following code to produce multiple boxplots, ranked by the mean value of the variables:
zx <- replicate (5, rnorm(50))
zx_means <- (colMeans(zx, na.rm = TRUE))
colnames (zx) <- seq_len (ncol (zx))
boxplot(zx [, order (zx_means)], horizontal = FALSE, outline = FALSE)
points(zx_means [ order (zx_means)], pch = 22, col = "darkgrey", lwd = 7)
(看到这个职位的更多详细信息)
当我改变code到水平= TRUE
,我不能做出点排队的盒状图。任何想法如何正确添加分
来横向箱线图?
When I change the code to horizontal = TRUE
, I'm not able to make the points line up with the boxplots. Any ideas for how to properly add points
to horizontal boxplots?
您需要给x和y坐标:
points(zx_means[order (zx_means)], seq_along(zx_means),
pch = 22, col = "darkgrey", lwd = 7)
或
points(zx_means, order (zx_means), pch = 22, col = "darkgrey", lwd = 7)