Adds error bars to an existing plot.

draw_error_bars(
  x,
  lower = NULL,
  upper = NULL,
  arrow = TRUE,
  flip = FALSE,
  length = 0.05,
  code = 3,
  angle = 90,
  border = NA,
  columns = NULL,
  ...
)

Arguments

x

Either a numeric vector or a data frame. If a numeric vector, specifies the positions at which error bars should be drawn.

lower

A numeric vector with the lower limits for error bars.

upper

A numeric vector with the upper limits for error bars.

arrow

Logical; if TRUE, adds error bars using graphics::arrows, otherwise adds error bars using graphics::polygon instead.

flip

Logical; if TRUE, error bars are drawn at positions on the y-axis with limits specified over the x-axis; otherwise, error bars are drawn at positions on the x-axis with limits specified over the y-axis.

length

The length of the arrowhead for the call to graphics::arrows.

code

Integer controlling whether to draw an arrowhead at the start (1), end (2), or at both ends (3) of the line for the call to graphics::arrows.

angle

The angle of the lines creating the arrowhead for the call to graphics::arrows. Using 90 degrees results in a flat bar per typical error bars.

border

The color of the border for calls to graphics::polygon.

columns

A character vector, the columns for the positions and lower/upper limits, respectively, if x is a data frame.

...

Additional plotting parameters for either the graphics::arrows or graphics::polygon.