Learn R Programming

phenology (version 3.72)

barplot_errbar: 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.

Value

  • Nothing

Details

plot_errbar plot a barplot with error bar on y

Examples

Run this code
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)

Run the code above in your browser using DataLab