hcell {hexbin}R Documentation

compute hexagon cell id's from x and y map projection coordinates

Description

Creates an hexbin list containing hexagon cell id's corresponding to (x,y) pairs. Used for partitioning data into hexagon regions and computation of statistics for each region. Provides symbol congestion control in maps.

Usage

hcell(x, y, xbins, shape, xbnds, ybnds, verbose = getOption("verbose"))

Arguments

x a vector of numbers. The first coordinate of bivariate data for cell id computation.
y a vector of numbers. The second coordinate of bivariate data for cell id computation.
xbins number of hexagon cells partitioning the range of xbnds.
xbnds horizontal limits of the region in x units.
ybnds vertical limits of the region in y units.
shape number giving shape=yheight/xwidth of the plotting region.
verbose logical indicating if some diagnostic output should happen.

Details

The plot shape must be maintained for hexagons to appear with equal sides. Calculations are in single precision.

Value

a list – similar to the class "hexbin", see hexbin. The list structure typically contains the following components:

cell vector of cell ids to supply to the table function
xbins number of hexagons across the x axis. hexagon inner diameter =diff(xbnds) / xbins in x units
xbnds x coordinate bounds for binning and plotting
ybnds y coordinate bounds for binning and plotting
shape plot shape= yheight(inches) / xwidth(inches)

References

Carr, D. B., A. R. Olsen, and D. White (1992) "Hexagon Mosaic Maps for Display of Univariate and Bivariate Geographical Data." Cartography and Geographic Information Systems 19, no. 4, 228–236, 271

See Also

hcell2xy, hray, hexbin

Examples

x <- rnorm(1000)
y <- rnorm(1000)
rangex <- range(x)
rangey <- range(y)
diffx <- diff(rangex)
diffy <- diff(rangey)
bin <- hcell(x, y, xbnds = rangex, ybnds = rangey, shape = diffy/diffx)
str(bin) # list of 6  ...

[Package hexbin version 1.0.10 Index]