Learn R Programming

magicaxis (version 1.6)

magcon: 2D quantile images and contours

Description

This function generates pretty images and contours that reflect the 2D quantile levels of the data. This means the user can immediately assess the 2D regime that contains an arbitrary percentage of the data. This function was designed particularly with the output of MCMC posteriors in mind, where visualising the location of the 68

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,...)

Arguments

x
x values to contour.
y
y values to contour.
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
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.
...
Other arguments to pass to the contour function, e.g. lty=c(2,1,3).

Value

  • Called for the side effect of generating images and contours representing quantile in 2D data.

Details

This function is particularly designed to assess the output for MCMC posteriors since it highlights the confidence regimes quite clearly. More generally it can show the quantile distributions for any 2D data.

See Also

magplot,magaxis,maglab,magmap,magrun,magbar

Examples

Run this code
temp=cbind(rnorm(1e3),rnorm(1e3))
magcon(temp[,1],temp[,2])

Run the code above in your browser using DataLab