stat_bin2d(mapping = NULL, data = NULL, geom = NULL, position = "identity", bins = 30, drop = TRUE, ...)
TRUEremoves all cells with 0 counts.
aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
layer. This can include aesthetics whose values you want to set, not map. See
layerfor more details.
Count number of observation in rectangular bins.
stat_bin2d understands the following aesthetics (required aesthetics are in bold):
d + geom_bin2d()
# You can control the size of the bins by specifying the number of # bins in each direction: d + stat_bin2d(bins = 10)
d + stat_bin2d(bins = 30)
# Or with a list of breaks x <- seq(min(diamonds$carat), max(diamonds$carat), by = 0.1) y <- seq(min(diamonds$price), max(diamonds$price), length = 50) d + stat_bin2d(breaks = list(x = x, y = y))
qplot(x, y, data = diamonds, geom="bin2d", binwidth = c(0.1, 0.1), xlim = c(4, 10), ylim = c(4, 10))
stat_binhexfor hexagonal binning