plot.distmap: Visualize a distribution mapping as a q-q plot with overlaid...

Description Usage Arguments Details Examples

View source: R/plot.distmap.R

Description

This function creates a Q-Q plot of the x and y elements of the distmap object. It overlays rug plots and pdf curves for the x and y values, an identity line and a curve for the transfer function, and dashed mapping lines running from the rug plots to the transfer function, showing how x values are mapped through the transfer function to the corresponding y values.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'distmap'
plot(x, lim = range(c(x$xq, x$yq)), pscale = 0.2,
  xmap = quantile(x), map.args = list(col = "red", lty = 2),
  identity.args = list(), rug.args = NULL, pdf.args = NULL,
  transfer.args = list(col = "red", lwd = 2), skip = NULL,
  xlim = lim, ylim = lim, pxscale = pscale, pyscale = pscale,
  pxlim = c(min(ylim), min(ylim) + diff(ylim) * pxscale),
  pylim = c(min(xlim), min(xlim) + diff(xlim) * pyscale), ...)

Arguments

x

An object of class 'distmap'.

lim

The range of the x and y axes. By default, the plot is set up to use the same range on both axes.

pscale

Vertical scaling of the PDF overlays, as a fraction of the plot size (0 to 1).

xmap

A vector of x-values for the mapping lines. Lines are drawn from the values specified by xmap up to the transfer function, then over to the y-axis. Defaults to the (5, 10, 25, 50, 75, 90, 95)th percentiles; pretty(range(x)) can also be informative.

map.args

A list of arguments to the segments() function, which is used to draw the mapping lines. Defaults to dashed red lines.

identity.args

A list of arguments to abline(), which is used to draw the identity line.

rug.args

A list of arguments to rug(), which is used to draw rug plots along the axes.

pdf.args

A list of arguments to lines(), which is used to draw the pdf curves.

transfer.args

A list of arguments to lines(), which is used to draw the transfer function. Defaults to a thick red line.

skip

A vector of names of the plot components which are to be skipped instead of plotted. The names of the components are: "identity", "xmap", "rug", "pdf", "transfer". The base Q-Q plot cannot be skipped. Partial matching of names is allowed.

xlim

The range of the x-axis, if specified differently from the y-axis.

ylim

The range of the y-axis, if specified differently from the x-axis.

pxscale

Scaling of the PDF overlay for x-values, if specified differently from the PDF for y-values.

pyscale

Scaling of the PDF overlay for y-values, if specified differently from the PDF for x-values.

pxlim

The vertical range of the PDF overlay for x-values, specified in data units along the y-axis. (An alternative to controlling the overlay height using pscale.)

pylim

The horizontal range of the PDF overlay for y-values, specified in data units along the x-axis. (An alternative to controlling the overlay width using pscale.)

...

Other arguments to qqplot(), which is used to set up the base plot on which all other components are overlaid.

Details

This function is a composite of several other graphics functions, which can be controlled by passing a list of arguments to the function used to make that component of the plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(nor1mix)
set.seed(222)

x <- rnorMix(1000, norMix(mu=c(-3,2), sigma=c(2,1), w=c(1,2)))
y <- rnorMix(1200, norMix(mu=c(-2,2)))

dmap <- distmap(x,y)
plot(dmap)

dev.new()
tblack <- adjustcolor("black",0.1)

plot(dmap, pscale=0.1, id=list(col="blue"),
     rug=list(col=tblack), pdf=list(col="blue",lty=3),
     skip=c("transfer", "xmap"), pxscale=0.3, pyscale=0.15,
     xlim=c(-10,10), pch=3, main="Example")

sethmcg/climod documentation built on Nov. 19, 2021, 11:12 p.m.