stat_binhex {ggplot2}R Documentation

stat_binhex

Description

Bin 2d plane into hexagons

Usage

stat_binhex(mapping=NULL, data=NULL, geom="hex", position="identity", bins=30, na.rm=FALSE, ...)

Arguments

mapping mapping between variables and aesthetics generated by aes
data dataset used in this layer, if not specified uses plot dataset
geom geometric used by this layer
position position adjustment used by this layer
bins NULL
na.rm NULL
... ignored

Details

This page describes stat_binhex, see layer and qplot for how to create a complete plot from individual components.

Value

A layer

Aesthetics

The following aesthetics can be used with stat_binhex. Aesthetics are mapped to variables in the data with the aes function: stat\_binhex(\code{aes}(x = var))

Author(s)

Hadley Wickham, http://had.co.nz/

See Also

Examples

## Not run: 
d <- ggplot(diamonds, aes(carat, price))
d + stat_binhex()
d + geom_hex()

# You can control the size of the bins by specifying the number of
# bins in each direction:
d + stat_binhex(bins = 10)
d + stat_binhex(bins = 30)

# Or by specifying the width of the bins
d + stat_binhex(binwidth = c(1, 1000))
d + stat_binhex(binwidth = c(.1, 500))

# With qplot
qplot(x, y, data = diamonds, geom="hex", xlim = c(4, 10), ylim = c(4, 10))
qplot(x, y, data = diamonds, geom="hex", xlim = c(4, 10), ylim = c(4, 10),
  binwidth = c(0.1, 0.1))
## End(Not run)

[Package ggplot2 version 0.8.2 Index]