geom_hex {animint2} | R Documentation |
Hexagon binning.
Description
Hexagon binning.
Usage
geom_hex(
mapping = NULL,
data = NULL,
stat = "binhex",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
stat_bin_hex(
mapping = NULL,
data = NULL,
geom = "hex",
position = "identity",
...,
bins = 30,
binwidth = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom , stat |
Override the default connection between |
bins |
numeric vector giving number of bins in both vertical and horizontal directions. Set to 30 by default. |
binwidth |
Numeric vector giving bin width in both vertical and
horizontal directions. Overrides |
Aesthetics
geom_hex
understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
fill
size
See Also
stat_bin2d
for rectangular binning
Examples
d <- ggplot(diamonds, aes(carat, price))
d + geom_hex()
# You can control the size of the bins by specifying the number of
# bins in each direction:
d + geom_hex(bins = 10)
d + geom_hex(bins = 30)
# Or by specifying the width of the bins
d + geom_hex(binwidth = c(1, 1000))
d + geom_hex(binwidth = c(.1, 500))