I have a 2d histogram created with stat_bin2d in the ggplot2 package. I\'d like to control both the number of breaks in the color gradient, as well
stat_bin2d
ggplot2
here is an example combining cut and bin2d:
cut
bin2d
p <- ggplot(df, aes(x, y, fill=cut(..count.., c(0,6,8,9,Inf)))) p <- p + stat_bin2d(bins = 20) p + scale_fill_hue("count")
As there are many ways to make the breaks arbitrary, if you define clearly what you want, probably you can get a better answer.