Hexagonal Bin Smoothing

DESCRIPTION:
Discrete kernel smoother covering seven cells, a center cell and its six neighbors. After two iterations, the kernel covers 1+6+12=19 cells effectively.

USAGE:
smooth.hexbin(bin, weights=c(48,4,1))

REQUIRED ARGUMENTS:
bin:
an object of class "hexbin".

OPTIONAL ARGUMENTS:
weights:
numeric vector containing the relative weights for the center hexagon, its six first-order neighbor cells, and its twelve second-order neighbors.

VALUE:
a data frame with columns cell and count. Inherits from class "hexbin".

DETAILS:
This discrete kernel smoother uses the center cell, immediate neighbors, and second neighbors to smooth the counts. The counts for each resulting cell are a linear combination of neighboring cell counts and weights.

If a cell, its immediate, and its second neighbors all have a value of max(bin$count) then the new maximum count is max(bin$count)*sum(weights)*(1+6+12).

Set weights[3]=0 if only immediate neighbors effects are desired.

The current implementation increases the domain attr(bin,"dims") by four rows and four columns, thus reducing plotting resolution.


REFERENCES:
Carr, D. B. (1991). Looking at large data sets using binned data plots. In Computing and Graphics in Statistics. A. Buja and P. Tukey, eds. Springer-Verlag, New York. pp. 7-39.

SEE ALSO:
hexbin , plot.hexbin , erode.hexbin .

EXAMPLES:
# Show the smooth counts in gray level
smoothbin  <- smooth.hexbin(mybin)
plot(smoothbin)

# Compare the smooth and the origin smbin1 <- smbin smbin1$count <- ceiling(smbin$count/sum(smbin$weights)) plot.hexbin(smbin1) # Expand the domain for comparability smbin2 <- smooth.hexbin(bin, weights=c(1,0,0)) plot.hexbin(smbin2)