Ggplot geom_tile color with textiles

I would like to create a geom_tile that can be filled with not only color but also textiles, is this possible?

Basically, I have this graph:

green red graph

But I need it to be black and white, so this is what I got: black white plot

But it is very difficult to see the difference between groups A and B in black and white. So, I thought that it would be better if he could cooperate with some textile products. For example, for values ​​from 0.0 to 1.0, the color is from white to black without a pattern, and for -1.0 to 0.0, the color is from black to white, but has some kind of pattern / textile on it.

Is this even possible?

This question inspires me: Filling bars in a bar with textiles in ggplot2 and I wonder if this can be applied to geom_tile ()?

This is what I would like, I painted it with Paint. with texture

The codes used to create these graphs are:

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() 
+5
source share

Source: https://habr.com/ru/post/1268168/


All Articles