hdiffplot {hexbin}R Documentation

Plot of Domain and Median Differences of Two 'hbin' Objects

Description

Let hbin1 and hbin2 represent two hexbin objects with scaling, plot shapes, and bin sizes. This plot distinguishes cells unique to hbin1, cells in common, and cells unique to hbin2 using color. When the erode components are present, color also distinguishes the two erosion medians. An arrow shows the vector from the median of hbin1 to the median of hbin2.

Usage

hdiffplot(bin1, bin2, xbnds, ybnds,
          density = rep.int(-1, 6), border = rep.int(FALSE, 6), pen = 2:7,
          size = 0.1, lwd = 2, eps = 1e-6, unzoom = 1.04,
          xlab = "", ylab = "", main = deparse(mycall), ...)

Arguments

bin1 an object of class hexbin.
bin2 an object of class hexbin.
xbnds global x-axis plotting limits. Used primarily for multiple comparison plots.
ybnds global y-axis plotting limits. Used primarily for multiple comparison plots.
density fill arguments to polygon
border border arguments to polygon
pen pen numbers for polgyon
size arrow type size in inches.
eps distance criteria for distinct medians
unzoom plot limit expansion factor when xbnds is missing
lwd To be added
xlab To be added
ylab To be added
main main title for the plot; automatically constructed by default.
... To be added

Details

The hexbin objects for comparison, hbin1 and hbin2, must have the same plotting limits and cell size. The plot produces a comparison overlay of the cells in the two objects. If external global scaling is not supplied, the algorithm determines plotting limits to increase resolution. For example, the objects may be the result of the erode.hexbin() and include only high count cells containing 50 of the counts. The density, border, and pen arguments correspond to the polygon function calls for plotting six types of cells. The cell types are respectively:
unique cells of hbin1,
joint cells,
unique cells of hbin2,
median cell of hbin1,
median cell of hbin2,
median cell if identical.

The erode components of the hexbin objects must be present for the medians to plot. The algorithm select a single cell for the median if there are algorithmic ties.

The pen numbers for types of cells start at Pen 2. Pen 1 is presumed black. The suggested six additional colors are light blue, light gray, light red, blue, red, and black. The reference below shows an example for black and white printing. That plot changes the six colors to light gray, dark gray, white, black, black, and black. It changes the 4th, 5th, and 6th argument of border to TRUE. It also changes 4th, 5th and 6th argument of density to 0. In other words cells in common do not show and medians cells appear as outlines.

When xbnds is missing, the plot changes graphics parameters and resets them. The function also zooms in based on the available data to provide increased resolution.

Value

invisible("Done")

References

see in hexagons.

See Also

hexbin, smooth.hexbin, erode.hexbin, hcell2xy, hcell, plot.hexbin, hboxplot, hmatplot, hexagons, hex.legend.

Examples

## Comparison of two bivariate boxplots
x1 <- rnorm(10000)
y1 <- rnorm(10000)
x2 <- rnorm(10000,mean=.3)
y2 <- rnorm(10000,mean=.3)
xbnds <- range(x1,x2)
ybnds <- range(y1,y2)

bin1 <- hexbin(x1,y1,xbnds=xbnds,ybnds=ybnds)
bin2 <- hexbin(x2,y2,xbnds=xbnds,ybnds=ybnds)
erodebin1 <- erode.hexbin(smooth.hexbin(bin1))
erodebin2 <- erode.hexbin(smooth.hexbin(bin2))

hdiffplot(erodebin1,erodebin2)

[Package hexbin version 1.0.10 Index]