smooth.hexbin(bin, weights=c(48,4,1))
"hexbin"
.
cell
and
count
. Inherits from
class
"hexbin"
.
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.
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.
# Show the smooth counts in gray level x <- rnorm(10000) y <- rnorm(10000) mybin <- hexbin(x,y) smbin <- smooth.hexbin(mybin) plot(smbin) # Compare the smooth and the origin smbin1 <- smbin smbin1$count <- ceiling(smbin$count/sum(attr(smbin,"weights"))) plot.hexbin(smbin1) # Expand the domain for comparability smbin2 <- smooth.hexbin(mybin, weights=c(1,0,0)) plot.hexbin(smbin2)