vertErrorBar: Draw vertical error bar(s) on a plot

Description Usage Arguments Details Value Author(s) Examples

View source: R/vertErrorBar.R

Description

Draw vertical error bar(s) on a plot

Usage

1
2
vertErrorBar(x, width, center = NULL, barLength = NULL, min.y = NULL,
  max.y = NULL, blankMiddle = NULL, ...)

Arguments

x

Vector of x value on the plot around which the vertical error bar will be drawn

width

The total width of the cross hatches on top and bottom of the bars, can be a vector or a single value

center

Vector of values designating the vertical center of the error bars, can be a vector or a single value

barLength

The total vertical length of the bars, can be a vector or a single value

min.y

Vector of values indicating the vertical bottoms of the bars

max.y

Vector of values indicating the vertical tops of the bars

blankMiddle

the vertical length of a blank spot that will be produced in the middle of the error bar. This is useful when the bar is placed around symbols (so as not to overwrite them). Defaults to NULL, in which case a solid error bar is drawn. Can also be a vector or a single value.

...

additional arguments to lines.

Details

Buyer beware! It's up to the user to determine what the statistically correct length of the error bar should be.

Either center and barLength must be specified, or min.y and max.y must be specifed.

Note that width, center, barLength, min.y, max.y, and blankMiddle should be NULL, numeric values of length 1, or numeric values with the same length as x. If they have the same length of x, the bars can have different vertical lengths, widths, and blankMiddle values if desired.

Value

Nothing is returned, the error bar(s) is/are drawn on the plot

Author(s)

Landon Sego

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(343)

# Make a plot of some standard normal observations
x <- 1:9
y <- rnorm(9)

plot(x, y, pch = as.character(1:9), ylim = c(-2, 2) + range(y),
     ylab = "Z", xlab = "Indexes")

# Draw the error bars
vertErrorBar(x, 0.3, center = y, barLength = 2 * 1.96, blankMiddle = 0.25)

Smisc documentation built on May 2, 2019, 2:46 a.m.