Last data update: 2014.03.03

R: Plotting a bivariate kernel density estimate object
plot.bivdenR Documentation

Plotting a bivariate kernel density estimate object

Description

plot methods for classes "bivden" and "rrs"

Usage

## S3 method for class 'bivden'
plot(x, ..., display = c("heat", "contour", "persp", "3d"),
 show.WIN = TRUE)
## S3 method for class 'rrs'
plot(x, ..., display = c("heat", "contour", "persp", "3d"),
 show.WIN = TRUE, tolerance.matrix = NULL,
 tol.opt = list(raise = 0.01, col = "black", levels = 0.05, lty = 1, lwd = 1))

Arguments

x

An object of class "bivden" resulting from a call to bivariate.density, or an object of class "rss" resulting from a call to risk.

...

Additional graphical parameters to be passed to the relevant plot command depending on the value of display.

display

One of four possible character strings indicating the kind of plot desired (see 'Details'). Defaults to "heat".

show.WIN

Boolean. Whether or not to draw the study region as an aesthetic enhancement to the plot of the density/risk surface. Defaults to TRUE.

tolerance.matrix

The matrix of p-values resulting from a call to tolerance and used to draw the asymptotic tolerance contours. If this argument is supplied, tolerance contours are automatically superimposed upon a display = "heat" or display = "3d" plot. Ignored for display = "persp" or display = "contour" plots. Defaults to NULL.

tol.opt

A named list of components that control plotting of the tolerance contours given by tolerance.matrix. Components col, levels, lty, and lwd are vectors of equal length controlling the colour, significance levels, line type (ignored for display = "3d") and line width of the plotted contours respectively. The element raise is a single numeric value and is used only when display = "3d". This vertically (i.e. with respect to the z axis) translates the contours atop the 3-D surface (see ‘Details’). A value of 0 requests no translation. Defaults to 0.01.

Details

There are currently four implemented plot types to visualise the estimated density or risk function. "heat" selects a heatplot, "contour" is simply a contour plot and "persp" creates a perspective plot. Selection of "3d" uses functions from the rgl package to open an RGL graphics device and creates a 3-dimensional surface which the user can interact with using the mouse. To use ... to improve the appearance of the four possible plot types "heat", "contour", "persp" and "3d", the reader is highly recommended to consult the relevant documentation in the help pages plot.im, contour, persp and persp3d respectively.

Adding tolerance contours to a "3d" relative risk plot requires the function to make some approximations to the vertical positioning of the contours at each corresponding coordinate. This can lead to some parts of normally visible contours falling ‘underneath’ the plotted surface, resulting in partially obscured contours. The element raise in tol.opt overcomes this issue by artificially raising the visible contours by a fixed amount. Care should be taken to find an appropriate value for raise for each analysis.

Value

Plots to the relevant graphics device.

Author(s)

T.M. Davies

See Also

bivariate.density, risk, plot.default, plot.im, contour,
persp, persp3d, par, par3d

Examples

## see Examples in documentation for functions 'bivariate.density',
##  'risk' and 'tolerance'.

Results