plotContours: Draws depth contours of bivariate data

View source: R/plotContours.R

plotContoursR Documentation

Draws depth contours of bivariate data

Description

Draws the depth contours of bivariate data computed with depthContour.

Usage

plotContours(x, depthContour, data = TRUE)

Arguments

x

An n by 2 data matrix.

depthContour

The result of a call to depthContour.

data

Logical value indicating whether the data x should be plotted.

Details

The plot is made using ggplot2. The plot itself is returned by the function and is fully customisable using standard ggplot2 commands.

Author(s)

P. Segaert

References

Ruts I., Rousseeuw P.J. (1996). Computing depth contours of bivariate point clouds. Computational Statistics & Data Analysis, 23, 153-168.

See Also

depthContour

Examples

# Compute and plot some halfspace depth contours of a two-dimensional dataset. 
# The returned object is a ggplot2 object that may be edited 
# using standard ggplot2 commands.
data(cardata90)
Result <- depthContour(x = cardata90,
                       alpha = c(0.125, 0.25))
plot <- plotContours(x = cardata90, depthContour = Result)
plot + ylab("Engine displacement") + xlab("Weight in pounds")

# One may consider different depth functions such as projection depth 
# by changing the input parameter 'type' in the depthcontour function.
Result <- depthContour(x = cardata90,
                       alpha = c(0.35, 0.55),
                       type = "projdepth")
plotContours(x = cardata90, depthContour = Result)

mrfDepth documentation built on Oct. 6, 2023, 5:07 p.m.