r - How to create black and white transparent overlapping histograms using ggplot2? -


i used ggplot2 create 2 transparent overlapping histograms.

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 

the resulting plot looks great, it's in color. need grayscale or black/white plot.

using "scale_fill_grey()" results in plot transparency difficult "read".

ideally, black/white plot uses texture instead of color, instance, cross hatching: "///" 1 condition, "\\\" other condition, resulting in "xxx" when bars overlap. possible?

how (no texturing still)?

fig = ggplot(test, aes(x = value, fill = condition)) +     geom_histogram(position = "identity", alpha = .8) +      scale_fill_manual(values=c("grey20", "grey60")) + theme_bw() fig 

enter image description here


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -