Usage
magcon(x, y, h, doim = TRUE, docon = TRUE, dobar = TRUE, n = 100, add = FALSE,
xlab='', ylab='', imcol = rev(rainbow(1000, start = 0, end = 2/3)),
conlevels = c(0.5, pnorm(1) - pnorm(-1), 0.95), barposition = "topright",
barorient = "v",bartitle = "Contained %", bartitleshift=0,xlim=NULL,ylim=NULL,
weights=NA,...)
Arguments
x
x values to contour. If x is a two (or more) column matrix or data.frame and y is missing as an argument, then the first column is used for x and the second column for y.
h
Smoothing parameter to pass to kde2d. Can take 1 or 2 arguments for x and optionally y smoothing.
doim
Should an image be generated.
docon
Should contours be overlain.
dobar
Should a magbar colour bar be added describing the image levels (doim must also be true for this to appear).
n
The n to send to kde2d to determine the resolution of the smoothing.
add
Should the output of this function be added to the current plot. If FALSE then a new plot is generated.
xlab
Label for x-axis, only used if add=FALSE.
ylab
Label for y-axis, only used if add=FALSE.
imcol
The colour palette to use for the image (this is also sent to magbar).
conlevels
Specific quantile contours to add. Default is for 50%, 68% and 95% contours, i.e. these contours contain that perecentage of the data.
barposition
The position to use for magbar. See magbar help for more details.
barorient
The orientation to use for magbar. See magbar help for more details.
bartitle
Title to use for magbar.
bartitleshift
Control of how far the magbar title is shifted away from its default position.
xlim
The x limits to use for the data. Default of NULL caculates the range based on the provided x data vector. Data will be clipped between the extremes given. If xlim[1]>xlim[2] plotted axes will be flipped compared to default.
ylim
The y limits to use for the data. Default of NULL caculates the range based on the provided y data vector. Data will be clipped between the extremes given. If ylim[1]>ylim[2] plotted axes will be flipped compared to default.
weights
A vector of weights to pass onto sm.density (that does the 2D density estimate). This must be the same length as the x and y vectors if specified.
...
Other arguments to pass to the contour function, e.g. lty=c(2,1,3).