hexbin
.
Its basic components are a cell identifier and a count of the points
falling into each occupied cell.
hexbin(x, y, xbins=30, shape=1, xlim=range(x), ylim=range(y))
x
values.
y
-direction given
xbins
,
the number of bins in the
x
-direction.
The default value
shape=1
makes
the hexagons appear equal-sided when plotted.
x
.
By default these are the minimum and maximum values
of
x
.
y
.
"hexbin"
.
This is a data frame with the following columns:
x
center of mass
(average of
x
values) for the cell.
y
center of mass
(average of
y
values) for the cell.
"hexbin"
.
hexbin
which generated the object.
x
axis.
Same as the input value for
xbins
.
Hexagons inner diameter equals
diff(xlim)/xbins
in
x
units
count
if treated as a matrix (
count[i,j]
).
xlim
.
ylim
.
shape
.
Returns counts for non-empty cells. The plot shape must be maintained for hexagons to appear with equal sides. Calculations are in single precision.
Carr, D. B., Littlefield, R. J., Nicholson, W. L. and Littlefield, J. S. (1987). Scatterplot matrix techniques for large N. Journal American Statistical Association 83, 424-436.
x <- rnorm(10000) y <- rnorm(10000) bin1 <- hexbin(x, y) trellis.device() plot(bin1,style="nested.centroids") # Lower resolution binning and overplotting with counts bin2 <- hexbin(x, y, xbins=25) plot.output <- plot(bin2, style="latt", minarea=1, maxarea=1, density=0, border=T) xy <- cell2xy(bin2) add.to.hexbin(plot.output, text(xy$x, xy$y, as.character(bin2$count), adj=.5, cex=.3))