I would like to create a geom_tile that can be filled not just colour but with textile as well, is this possible?
Basically, I have this graph:
But, I need it to be in black/white, so this is what I got:
But it is very difficult to see the difference between Group A and B in the black and white mode. So, I was thinking it would be better if it can cooperate some textile in. For example, for values 0.0 to 1.0 the colour is from white to black with no pattern, and for -1.0 to 0.0 the colour is black to white but has some sort of pattern/textile on it.
Is this possible at all?
I am inspired from this question: Filling bars in barplot with textiles in ggplot2 and wondering if this can be applied to geom_tile()?
This is what I would like, I drew this using Paint.
The codes used to produce these graphs:
library(reshape2)
library(ggplot2)
dat = rbind.data.frame(c(0.1038, 0.1224, 0.0906, 0.1859, -0.0811, "Group.A"),
c(-0.1551, -0.1829, -0.1354, -0.2776, 0.1212, "Group.B"))
colnames(dat) = c("A", "B", "C", "D", "E", "Group")
m = melt(sub.all, id.vars = "Group")
#Red/green
ggplot(m, aes(variable, factor(Group))) + geom_tile(aes(fill = value), colour = "white") +
scale_fill_gradient2(low = "green", high = "red", mid = "white", limits = c(-1,1)) + coord_flip()
#Black/white
ggplot(m, aes(variable, factor(Group))) + geom_tile(aes(fill = value), colour = "white") +
scale_fill_gradient2(low = "grey50", high = "black", mid = "white", limits = c(-1,1)) + coord_flip()