添加点水平盒状图 [英] Adding points to horizontal boxplots
本文介绍了添加点水平盒状图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用下面的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)
这篇关于添加点水平盒状图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文