I have the following hexbin plot:
I would like the count to start from the lowest possible count, for example 10, and show that with different colour. Note that the lowest count differs with different datasets. Therefore, it is difficult to set it to a specific number. The script that I have written to generate the plot is:
d <- ggplot(selectedDF, aes(BEC_Agg, AC)) + geom_hex(bins = 30) + theme_bw() +
theme(text = element_text(face = "bold", size = 16)) + xlab("\nNormalized BEC") + ylab("AC\n") + scale_fill_gradientn(colors = brewer.pal(3,"Dark2"))
I tried the solution here:
d <- ggplot(selectedDF, aes(BEC_Agg, AC)) + geom_hex(aes(fill=cut(..value..,breaks=pretty(..value..,n=5))),bins = 30) + theme_bw() +
theme(text = element_text(face = "bold", size = 16)) + xlab("\nNormalized BEC") + ylab("AC\n") + scale_fill_gradientn(colors = brewer.pal(3,"Dark2"))
But I got the following error:
Error in cut(value, breaks = pretty(value, n = 5)) :
object 'value' not found
How can I fix that?