# magerr

0th

Percentile

##### Error bar plotting

A function to dd x and y error bars to plots. Low and high error bars can be generated.

Keywords
error
##### Usage
magerr(x, y, xlo, ylo, xhi = xlo, yhi = ylo, corxy, length = 0.02,
col = 'black', fill = FALSE, poly = FALSE, ...)
##### Arguments
x

x location of data.

y

y location of data.

xlo

Error on the low side for x values. This can be positive or negative- the absolute vaue is used.

ylo

Error on the low side for y values. This can be positive or negative- the absolute vaue is used.

xhi

Error on the high side for x values. This can be positive or negative- the absolute vaue is used. By default this will inherit the xlo value.

yhi

Error on the high side for y values. This can be positive or negative- the absolute vaue is used. By default this will inherit the ylo value.

corxy

If this paramter exists then error ellipses will be drawn instead of error bars. It takes the value of the sigma_x sigma_y correlation, i.e. corxy=covxy/(xlo*ylo).

length

Length of error bar ends.

col

Either the colour of the error bars or the outline colour of the error ellipses.

fill

Logical; if TRUE then the error ellipses will be filled, if FALSE then only the border will be drawn.

poly

Logical; is FALSE then error bars or ellipses will be drawn, if TRUE then approximate error polygon will be shown instead.

Further arguments to be passed to the arrows / draw.ellipse / polygon functions used to draw the error bars / error ellipses (corxy not missing) / error polygon (poly=TRUE).

##### Details

Note that with poly=TRUE the x values are used igoring any error terms, and the point value y errors are used to define the limits of the polygon, with straight lines joining the points. The col option is used to fill the polygon with a colour (so the default black is probably not a great choice). The polygon function takes the argument border (parsed by dots from the magerr function) to colour the outer lines, so for a more subtle error polygon you might want to use col=lightgrey, border=NA, where NA means no outer border lines are drawn.

##### Value

Called for the side effect of plotting error bars.

magplot, magaxis, maglab, magmap, magrun, arrows, draw.ellipse, polygon

• magerr
##### Examples
# NOT RUN {
# Basic x and y errors added to plot
temp=cbind(x=runif(10),y=runif(10),xerr=runif(10,0.05,0.2),yerr=runif(10,0.1,0.3),
corxy=runif(10,-1,1))
magplot(temp[,1:2])
magerr(x=temp[,1],y=temp[,2],xlo=temp[,3],ylo=temp[,4])
# Example of errors on plots wityh log axes
magplot(temp[,1:2],log='xy')
magerr(x=temp[,1],y=temp[,2],xlo=temp[,3],ylo=temp[,4])

#Example of error ellipses

magplot(temp[,1:2])
magerr(x=temp[,1],y=temp[,2],xlo=temp[,3],ylo=temp[,4])
magerr(x=temp[,1],y=temp[,2],xlo=temp[,3],ylo=temp[,4],corxy=temp[,5])

# }

Documentation reproduced from package magicaxis, version 2.0.7, License: GPL-3

### Community examples

Looks like there are no examples yet.