So my problem is, I have a data frame that I am plotting with geom_hex from ggplots. and my command looks like this:
ggplot(data, aes(x=var1,y=var2))+geom_hex(bins=20)+facet_grid(fac1 ~ fac2,scales="free")
The problem I am having is that the colouring scheme for the counts is shared across all graphs. I am wondering if there is any quick way to generate a count color scheme per row (or column) of graphs. I tried playing with scales, but seems that that this only works on the scales on y and x axis, and not with the histogram colors and histogram color legend. thnx! Here is an example of the data:
fac1<-c(rep(1, 6000), rep(2, 1000))
fac2<-c(rep("a", 3000), rep("b", 3000),rep("a", 500), rep("b", 500))
var1<-rnorm(7000)
var2<-rnorm(7000)
data<-data.frame(fac1,fac2,var1,var2)
ggplot(data, aes(x=var1,y=var2))+geom_hex(bins=20)+facet_grid(fac1 ~ fac2,scales="free")
Because there is so much more data from one factor, the color scheme is dominated by the first row of graphs, and would like to have the same coloring scheme but adjusted by the counts of every row.