6
我用ggplot2创建了两个透明的重叠直方图。如何使用ggplot2创建黑白透明重叠直方图?
test = data.frame(condition = rep(c("a", "b"), each = 500), value = rep(-1, 1000))
test[1:500,]$value = rnorm(500)
test[501:1000,]$value = rnorm(500) + 2
fig = ggplot(test, aes(x = value, fill = condition)) +
#scale_fill_grey() +
geom_histogram(position = "identity", alpha = .5)
fig
由此产生的情节看起来不错,但它的颜色。我需要灰度或黑/白的阴谋。
使用“scale_fill_grey()”会导致透明度很难“读取”的情节。理想情况下,我想要一个使用纹理而不是颜色的黑色/白色阴谋,例如交叉阴影:一个条件为“///”,另一个条件为“\\\”,导致“XXX “当酒吧重叠。这可能吗?
据我所知,纹理是不可能的'ggplot2'。 – Arun 2013-05-08 21:23:56
是否可以使用函数hist()或truehist()(来自MASS库)的纹理? – user2363777 2013-05-09 16:54:38