Learn R Programming

magicaxis (version 2.0.0)

magerr: Error bar plotting

Description

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

Usage

magerr(x, y, xlo, ylo, xhi = xlo, yhi = ylo, corxy, length = 0.02, col = 'black',fill=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
If fill=TRUE then the error ellipses will be filled, if FALSE then only the border will be drawn.
...
Further arguments to be passed to the arrows / draw.ellipse functions used to draw the error bars / error ellipses.

Value

Called for the side effect of plotting error bars.

See Also

magplot,magaxis,maglab,magmap,magrun

Examples

Run this code
# 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])

Run the code above in your browser using DataLab