Learn R Programming

magicaxis (version 1.6)

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 = FALSE, ylo = FALSE, xhi = xlo, yhi = ylo, log = "",
length=0.02, ...)

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.
log
Set which axes are logged. Allowed values are 'x', 'y', 'xy', 'yx' or '' (default, which means axes are not logged). This is not strictly required, but it is used to catch errors that drop below 0, setting them instead to a very small value that will ensu
length
Length of error bar ends.
...
Further arguments to be passed to the arrows function used to draw the error bars.

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(runif(10),runif(10),runif(10,0.05,0.2),runif(10,0.1,0.3))
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],log='xy')

Run the code above in your browser using DataLab