hexbin {hexbin} | R Documentation |
Creates an list object. Basic components are a cell id and a count of points falling in each occupied cell.
hexbin(x, y, xbins=30, shape=1, xbnds=range(x), ybnds=range(y))
x |
a vector of numbers. The first coordinate of bivariate data to be binned. |
y |
a vector of numbers. The second coordinate of bivariate data to be binned. |
xbins |
The number of bins partitioning the range of xbnds. |
shape |
The shape=yheight/xwidth of the plotting regions. |
xbnds |
The horizontal limits of the binning region in x units. |
ybnds |
The vertical limits of the binning region in y units. |
Returns counts for non-empty cells. The plot shape must be maintained for hexagons to appear with equal sides. Calculations are in single precision.
Note that when plotting with plot.hexbin
, the plotting parameters
are changed during the plot and it returns the changed par
parameters, so to utilize the same plot window one must be sure to also
use these par
values for it to work properly.
an object of type hexbin The list structure typically contains the following components:
cell |
A vector of cell ids that can be mapped into the (x,y) bin centers in data units. |
cnt |
A vector of counts in the cells. |
xcm |
The x center of mass (average of x values) for the cell. |
ycm |
The y center of mass (average of y values) for the cell. |
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) |
dim |
The i and j limits of cnt treated as a matrix cnt[i,j] |
Carr, D. B. et al. (1987) "Scatterplot Matrix Techniques for Large N", JASA 83, 398, 424–436.
smooth.hexbin, erode.hexbin, hthin, hcell2xy, hcell, plot.hexbin, hboxplot, hdiffplot, hmatplot, hexagons, hex.legend
x <- rnorm(10000) y <- rnorm(10000) bin <- hexbin(x,y) ## Using plot method for hexbin objects: plot(bin, style = "nested.lattice") # lower resolution binning and overplotting with counts bin <- hexbin(x,y,xbins=25) screenpar <- plot.hexbin(bin, style="lattice", minarea=1, maxarea=1, density=0, border=TRUE) oldpar <- par(screenpar) # reset graphics to the plot on the screen xy <- hcell2xy(bin) text(xy$x,xy$y,as.character(bin$cnt),adj=.5,cex=.3) points(x,y) # to show points rather than counts par(oldpar) #reset graphics