Skip to contents

Unlike normal binning stat, this stat does not change the number of rows in the data. Rather than summing weights, it merely adds xmin, xmax, ymin, and ymax values to the original data. This is useful for geom_calendar(), which only has one tile per row and therefore would only have a single entry contributing to each bin. ggplot2::stat_bin_2d() would cause the other fields to be discarded since it summarises the data.

Usage

stat_bin_location(
  mapping = NULL,
  data = NULL,
  geom = "rect",
  position = "identity",
  ...,
  overflow = FALSE,
  breaks = NULL,
  bins = 30,
  binwidth = NULL,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping, data, geom, position, bins, binwidth, na.rm, show.legend, inherit.aes, ...

See ggplot2::stat_bin_2d().

overflow

If TRUE, map values that would normally be outside the range to peripheral bins that span from the closest limit to the closest infinity. You can control this for x and y separately by passing a list.

breaks

Controls the break positions for the bins. Can be NULL, a numeric vector, or a function as per ggplot2::stat_bin(). Can additionally be a character specifying which breaks from the scale should be used: "minor" for minor breaks, "major" for major breaks, or "all" for both. This can be a scalar or a list of length 2 to control the axes separately.

Value

ggplot2 stat layer.