I have the code as given below
d = data.frame(sites=rep(paste("S", 1:31),each=12),
value=runif(31*12),
panel=c(rep("Group 1",16*12), rep("Group 2", 12*12),
rep("Group 3", 3*12)))
ggplot(d, aes(x = sites, y = factor(0))) +
geom_tile(aes(fill = value)) +
scale_fill_gradient(low = "green", high = "blue") +
facet_wrap(~ panel, ncol = 1)
Now instead of the single scale, i want separate gradient scales for each group.