ggplot2 (version 2.0.0)

stat_summary_bin: Summarise y values at unique/binned x x.

Description

stat_summary operates on unique x; stat_summary_bin operators on binned x. They are more flexible versions of stat_bin: instead of just counting, the can compute any aggregate.

Usage

stat_summary_bin(mapping = NULL, data = NULL, geom = "pointrange",
  fun.data = NULL, fun.y = NULL, fun.ymax = NULL, fun.ymin = NULL,
  fun.args = list(), na.rm = FALSE, position = "identity",
  show.legend = NA, inherit.aes = TRUE, ...)

stat_summary(mapping = NULL, data = NULL, geom = "pointrange", fun.data = NULL, fun.y = NULL, fun.ymax = NULL, fun.ymin = NULL, fun.args = list(), na.rm = FALSE, position = "identity", show.legend = NA, inherit.aes = TRUE, ...)

Arguments

mapping
Set of aesthetic mappings created by aes or aes_. If specified and inherit.aes = TRUE (the default), is combined with the default mapping at the top le
data
A data frame. If specified, overrides the default data frame defined at the top level of the plot.
geom
Use to override the default connection between geom_histogram/geom_freqpoly and stat_bin.
fun.data
A function that is given the complete data and should return a data frame with variables ymin, y, and ymax.
fun.ymin, fun.y, fun.ymax
Alternatively, supply three individual functions that are each passed a vector of x's and should return a single number.
fun.args
Optional additional arguments passed on to the functions.
na.rm
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
position
Position adjustment, either as a string, or the result of a call to a position adjustment function.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g.
...
other arguments passed on to layer. There are three types of arguments you can use here:

  • Aesthetics: to set an aesthetic to a fixed value, likecolor = "red"orsize = 3.