barplot_errbar {HelpersMG}R Documentation

Plot a barplot graph with error bar on y

Description

To plot data, just use it as a normal barplot but add the errbar.y values or errbar.y.minus, errbar.y.plus if bars for y axis are asymetric. Use y.plus and y.minus to set absolut limits for error bars. Note that y.plus and y.minus have priority over errbar.y, errbar.y.minus and errbar.y.plus.

Usage

barplot_errbar(
  ...,
  errbar.y = NULL,
  errbar.y.plus = NULL,
  errbar.y.minus = NULL,
  y.plus = NULL,
  y.minus = NULL,
  errbar.tick = 1/50,
  errbar.lwd = par("lwd"),
  errbar.lty = par("lty"),
  errbar.col = par("fg"),
  add = FALSE
)

Arguments

...

Parameters for barplot() such as main= or ylim=

errbar.y

The length of error bars for y. Recycled if necessary.

errbar.y.plus

The length of positive error bars for y. Recycled if necessary.

errbar.y.minus

The length of negative error bars for y. Recycled if necessary.

y.plus

The absolut position of the positive error bar for y. Recycled if necessary.

y.minus

The absolut position of the nagative error bar for y. Recycled if necessary.

errbar.tick

Size of small ticks at the end of error bars defined as a proportion of total width or height graph size.

errbar.lwd

Error bar line width, see par("lwd")

errbar.lty

Error bar line type, see par("lwd")

errbar.col

Error bar line color, see par("col")

add

If true, add the graph to the previous one.

Details

barplot_errbar plot a barplot with error bar on y

Value

A numeric vector (or matrix, when beside = TRUE), say mp, giving the coordinates of all the bar midpoints drawn, useful for adding to the graph.
If beside is true, use colMeans(mp) for the midpoints of each group of bars, see example.

Author(s)

Marc Girondot marc.girondot@gmail.com

See Also

plot_errorbar

Other plot and barplot functions: ScalePreviousPlot(), plot_add(), plot_errbar(), show_name()

Examples

## Not run: 
barplot_errbar(rnorm(10, 10, 3), 
	xlab="axe x", ylab="axe y", bty="n", 
		errbar.y.plus=rnorm(10, 1, 0.1), col=rainbow(10), 
		names.arg=paste("Group",1:10), cex.names=0.6)
y <- rnorm(10, 10, 3)
barplot_errbar(y, 
               	xlab="axe x", ylab="axe y", bty="n", 
            		y.plus=y+2)

## End(Not run)

[Package HelpersMG version 6.1 Index]