Description Usage Arguments Examples
View source: R/utility_functions.R
Adds error bars to an already existing plot.
1 |
pos |
A single value or a vector of N values, indicating the position(s) at which an error bar should be drawn. |
limits |
A vector of 2 values or a 2 x N matrix giving the lower and upper limits, respectively, of the error bars. |
lb |
A vector of N values with the lower limits for the error bars. |
ub |
A vector of N values with the upper limits for the error bars. |
arrow |
Logical; if |
flip |
Logical; If |
... |
Additional plotting parameters for the
|
1 2 3 4 5 6 7 8 9 10 11 | # Example of 95% versus 68% intervals for standard normal
plot( c(0,1),c(-6,6),type='n',xaxt='n',xlab=' ',ylab='z-scores' )
pos = c(.25,.75)
limits = cbind( qnorm( c(.025,.975) ), qnorm( c(.16,.84) ) )
errorBars( pos, limits, length = .05, lwd = 2 )
text( pos, limits[2,], c("95%","68%"), pos = 3 )
abline(h=0)
# Example of connected error bars
plot( c(0,1),c(0,1),type='n',xlab=' ',ylab=' ' )
errorBars( c(.2,.8),lb=c(.2,.2),ub=c(.8,.8),arrow=F,col='grey')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.