hcell {hexbin} | R Documentation |
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.
hcell(x, y, xbins, shape, xbnds, ybnds, verbose = getOption("verbose"))
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. |
The plot shape must be maintained for hexagons to appear with equal sides. Calculations are in single precision.
an object of class hexbin. The list structure typically contains the following components:
cell |
A 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) |
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, Vol. 19 No. 4, pp. 228-236, 271
hcell2xy, hgrid, hray, hexbin
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)