forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstat_summary_hex.Rd
59 lines (46 loc) · 1.75 KB
/
stat_summary_hex.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2 (4.0.0): do not edit by hand
\name{stat_summary_hex}
\alias{stat_summary_hex}
\title{Apply funciton for 2D hexagonal bins.}
\usage{
stat_summary_hex(mapping = NULL, data = NULL, geom = "hex",
position = "identity", bins = 30, drop = TRUE, fun = mean, ...)
}
\arguments{
\item{bins}{see \code{\link{stat_binhex}}}
\item{drop}{drop if the output of \code{fun} is \code{NA}.}
\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}
}
\description{
Apply function for 2D hexagonal bins.
}
\section{Aesthetics}{
\Sexpr[results=rd,stage=build]{ggplot2:::rd_aesthetics("stat", "summaryhex")}
\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 aesthetics:
\itemize{
\item \code{x}: horizontal position
\item \code{y}: vertical position
\item \code{z}: value passed to the summary function
}
}
\examples{
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)
}
\seealso{
\code{\link{stat_summary2d}} for rectangular summarization. \code{\link{stat_bin2d}} for the hexagon-ing options.
}