scatterplot: Create a scatter plot with error ellipses or crosses

View source: R/errorellipse.R

scatterplotR Documentation

Create a scatter plot with error ellipses or crosses

Description

Takes bivariate data with (correlated) uncertainties as input and produces a scatter plot with error ellipses or crosses as output. (optionally) displays the linear fit on this diagram, and can show a third variable as a colour scale.

Usage

scatterplot(
  xy,
  oerr = 3,
  show.numbers = FALSE,
  show.ellipses = 1,
  levels = NA,
  clabel = "",
  ellipse.fill = c("#00FF0080", "#FF000080"),
  ellipse.stroke = "black",
  fit = NULL,
  add = FALSE,
  empty = FALSE,
  ci.col = "gray80",
  line.col = "black",
  lwd = 1,
  hide = NULL,
  omit = NULL,
  omit.fill = NA,
  omit.stroke = "grey",
  addcolourbar = TRUE,
  bg,
  cex,
  xlim = NULL,
  ylim = NULL,
  xlab,
  ylab,
  asp = NA,
  log = "",
  taxis = FALSE,
  box = !taxis,
  xaxt = ifelse(taxis, "n", "s"),
  ...
)

Arguments

xy

matrix with columns X, sX, Y, sY(, rXY)

oerr

indicates whether the analytical uncertainties of the output are reported as:

1: 1\sigma absolute uncertainties.

2: 2\sigma absolute uncertainties.

3: absolute (1-\alpha)% confidence intervals, where \alpha equales the value that is stored in settings('alpha').

4: 1\sigma relative uncertainties (\%).

5: 2\sigma relative uncertainties (\%).

6: relative (1-\alpha)% confidence intervals, where \alpha equales the value that is stored in settings('alpha').

show.numbers

logical flag (TRUE to show grain numbers)

show.ellipses

show the data as:

0: points

1: error ellipses

2: error crosses

levels

a vector with additional values to be displayed as different background colours within the error ellipses.

clabel

label for the colour scale

ellipse.fill

Fill colour for the error ellipses. This can either be a single colour or multiple colours to form a colour ramp. Examples:

a single colour: rgb(0,1,0,0.5), '#FF000080', 'white', etc.;

multiple colours: c(rbg(1,0,0,0.5), rgb(0,1,0,0.5)), c('#FF000080','#00FF0080'), c('blue','red'), c('blue','yellow','red'), etc.;

a colour palette: rainbow(n=100), topo.colors(n=100,alpha=0.5), etc.; or

a reversed palette: rev(topo.colors(n=100,alpha=0.5)), etc.

For empty ellipses, set ellipse.col=NA

ellipse.stroke

the stroke colour for the error ellipses. Follows the same formatting guidelines as ellipse.fill

fit

the output of york() (optional).

add

if TRUE, adds the points and lines to the existing plot.

empty

set up an empty plot with the right axis limits to fit the data

ci.col

the fill colour for the confidence interval of the intercept and slope.

line.col

colour of the regression line

lwd

line width of the regression line

hide

vector with indices of aliquots that should be removed from the plot.

omit

vector with indices of aliquots that should be plotted but omitted from the isochron age calculation.

omit.fill

fill colour that should be used for the omitted aliquots.

omit.stroke

stroke colour that should be used for the omitted aliquots.

addcolourbar

add a colour bar to display the colours used to levels

bg

background colour for the plot symbols (only used if show.ellipses=0).

cex

plot symbol magnification.

xlim

(optional) two-element vector with the x-axis limits

ylim

(optional) two-element vector with the y-axis limits

xlab

(optional) x-axis label (only used when add=FALSE)

ylab

(optional) y-axis label (only used when add=FALSE)

asp

the y/x aspect ratio, see ‘plot.window’.

log

same as the eponymous argument to the generic plot function.

taxis

logical. If TRUE, replaces the x-axis of an inverse isochron with a time scale. Only used if inverse=TRUE.

box

logical. If TRUE, draws a frame around the plot.

xaxt

see ?par

...

optional arguments to format the points and text.

Examples

X <- c(1.550,12.395,20.445,20.435,20.610,24.900,
       28.530,50.540,51.595,86.51,106.40,157.35)
Y <- c(.7268,.7809,.8200,.8116,.8160,.8302,
       .8642,.9534,.9617,1.105,1.230,1.440)
sX <- X*0.02
sY <- Y*0.01
dat <- cbind(X,sX,Y,sY)
scatterplot(dat,fit=york(dat),show.ellipses=2)

IsoplotR documentation built on Oct. 19, 2024, 5:07 p.m.