我很难为R中的Beanplot中的每一行分配颜色,最后,我找到了一个很好的解决方案here。我想扩展这个问题并询问是否有任何方法可以根据每组数据移除整体或可能的颜色(即蓝线为蓝色,这对我来说是最好的)。基于Here.
,似乎没有任何方法或因素我使用相同的示例进行微小更改:
library(beanplot)
x <- rnorm(15)
colpref <- c(5, 5, 3, 5, 5, 3, 5, 5, 3, 3, 5, 5, 5, 3, 3)
beanplot(x[colpref==3],ll = 1, col = c(0,3,3,3), what=c(1,0,1,1),axes = FALSE,method = "stack", add=FALSE)
beanplot(x[colpref==5],ll = 1, col = c(0,5,5,5), what=c(1,0,1,1), axes = FALSE,method = "stack", add=TRUE)
beanplot(x,ll = 1, col = c(0,5,5,5), what=c(0,1,0,0), axes = FALSE,method = "stack", add=TRUE)
答案 0 :(得分:0)
我找到了一种方法来关闭整个城堡,它是通过将0作为第一个元素来完成的,但是仍然期待它变得丰富多彩。
beanplot(x[colpref==3],ll = 1, col = c(0,3,3,3), what=c(0,0,1,1),axes =
FALSE,method = "stack", add=FALSE)
beanplot(x[colpref==5],ll = 1, col = c(0,5,5,5), what=c(0,0,1,1), axes = FALSE,method = "stack", add=TRUE)
beanplot(x,ll = 1, col = c(0,5,5,5), what=c(0,1,0,0), axes = FALSE,method = "stack", add=TRUE)