Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (52 sloc) 1.76 KB
\title{Apply funciton for 2D hexagonal bins.}
stat_summary_hex(mapping = NULL, data = NULL,
geom = "hex", position = "identity", bins = 30,
drop = TRUE, fun = mean, ...)
\item{bins}{see \code{\link{stat_binhex}}}
\item{drop}{drop if the output of \code{fun} is
\item{fun}{function for summary.}
\item{...}{parameters passed to \code{fun}}
\item{mapping}{The aesthetic mapping, usually constructed
with \code{\link{aes}} or \code{\link{aes_string}}. Only
needs to be set at the layer level if you are overriding
the plot defaults.}
\item{data}{A layer specific dataset - only needed if you
want to override the plot defaults.}
\item{geom}{The geometric object to use display the data}
\item{position}{The position adjustment to use for
overlappling points on this layer}
Apply function for 2D hexagonal bins.
\code{stat_summary2d} is hexagonal version of
\code{\link{stat_summary}}. The data are devided by
\code{x} and \code{y}. \code{z} in each cell is passed to
arbitral summary function.
\code{stat_summary-hex} requires the following
\itemize{ \item \code{x}: horizontal position \item
\code{y}: vertical position \item \code{z}: value passed
to the summary function }
d <- ggplot(diamonds, aes(carat, depth, z = price))
d + stat_summary_hex()
# Specifying function
d + stat_summary_hex(fun = function(x) sum(x^2))
d + stat_summary_hex(fun = var, na.rm = TRUE)
\code{\link{stat_summary2d}} for rectangular
summarization. \code{\link{stat_bin2d}} for the
hexagon-ing options.
Jump to Line
Something went wrong with that request. Please try again.