x
and
y
xy2cell(x, y, xbins=30, shape=1, xlim=range(x), ylim=range(y))
bdNumeric
. Usually the first (horizontal) coordinate of
bivariate data to be binned into hexagonal cells.
bdNumeric
. Usually the second (vertical) coordinate of bivariate
data to be binned.
x
values.
x
.
By default these are the minimum and maximum values of
x
.
y
.
bdVector
of cell identifiers that can be mapped into the bin centers
in data units. This vector or
bdVector
will have the same length as
x
and
y
.
The result also has the following attributes:
shape
.
xlim
.
ylim
.
The plot shape must be maintained for hexagons to appear with
equal sides. Calculations are in single precision.
This function can be used to compute statistics per cell. See the EXAMPLES
below for one such instance.
Carr, D. B., Olsen, A. R. and White, D. (1992). Hexagon mosaic maps for display of univariate and bivariate geographical data. Cartography and Geographics Information Systems, 19, 228-236.
ozone.bin <- hexbin(ozone.xy$x, ozone.xy$y, xbins=8) ozone.cells <- xy2cell(ozone.xy$x, ozone.xy$y, xbins=8) # Find the median of each hexagonal cell: ozone.angle <- tapply(ozone.median,ozone.cells,median) usa(xlim=c(72, 77), ylim=c(38, 45), lty=2) rayplot(ozone.bin$xcenter,ozone.bin$ycenter,ozone.angle)