I am trying to make a thermal graph for discrete results (each value uses a single color), so that:
df<-data.frame(x=rep(LETTERS[1:10], each=10), y=rep(1:10,10), value=sample(1:8, 100,replace=T)) colors<-c("green", "lightyellow", "yellow", "orange", "orangered", "red", "darkred", "black") ggplot(df, aes(x=x, y=y))+ geom_tile(aes(fill=value), colour="white")+ #scale_fill_gradient(low="green", high="red") scale_fill_manual(values=colors) Error: Continuous value supplied to discrete scale
Does anyone know how to fix it and apply a color variable to a heat map?
source share