plot_errbar {HelpersMG} | R Documentation |
Plot a xy graph with error bar on x and/or y
Description
To plot data, just use it as a normal plot but add the errbar.x
and errbar.y values or errbar.x.minus, errbar.x.plus if bars for x axis are
asymetric and errbar.y.minus, errbar.y.plus if bars for y axis are
asymetric. Use x.plus, x.minus, y.plus and y.minus to set absolut limits for
error bars. Note that x.plus and x.minus have priority over errbar.x, errbar.x.minus and
errbar.x.plus and that y.plus and y.minus have priority over errbar.y, errbar.y.minus and
errbar.y.plus.
The parameter errbar.y.polygon=TRUE permits to define error as an envolop for y axis.
Usage
plot_errbar(
...,
errbar.x = NULL,
errbar.y = NULL,
errbar.x.plus = NULL,
errbar.x.minus = NULL,
errbar.y.plus = NULL,
errbar.y.minus = NULL,
x.plus = NULL,
x.minus = NULL,
y.plus = NULL,
y.minus = NULL,
errbar.tick = 1/50,
errbar.lwd = par("lwd"),
errbar.lty = par("lty"),
errbar.col = par("fg"),
errbar.y.polygon = FALSE,
errbar.y.polygon.list = list(NULL),
names = NULL,
add = FALSE
)
Arguments
... |
Parameters for plot() such as main= or ylim= |
errbar.x |
The length of error bars for x. Recycled if necessary. |
errbar.y |
The length of error bars for y. Recycled if necessary. |
errbar.x.plus |
The length of positive error bars for x. Recycled if necessary. |
errbar.x.minus |
The length of negative error bars for x. 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. |
x.plus |
The absolut position of the positive error bar for x. Recycled if necessary. |
x.minus |
The absolut position of the negative error bar for x. 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") |
errbar.y.polygon |
If true, the errors are shown as a filed polygon. |
errbar.y.polygon.list |
List of parameters to be used for polygon. |
names |
The names of the points to be used with show_name(). |
add |
If true, add the graph to the previous one. |
Details
plot_errbar plot a xy graph with error bar on x and/or y
Value
A list with x, y and names for points
Author(s)
Marc Girondot marc.girondot@gmail.com
See Also
barplot_errorbar
Other plot and barplot functions:
ScalePreviousPlot()
,
barplot_errbar()
,
plot_add()
,
show_name()
Examples
## Not run:
plot_errbar(1:100, rnorm(100, 1, 2),
xlab="axe x", ylab="axe y", bty="n", xlim=c(1,100),
errbar.x=2, errbar.y=rnorm(100, 1, 0.1))
x <- 1:100
plot_errbar(x=1:100, rnorm(100, 1, 2),
xlab="axe x", ylab="axe y", bty="n", xlim=c(1,100),
x.minus=x-2, x.plus=x+2)
x <- 1:100
plot_errbar(x=1:100, rnorm(100, 1, 2),
xlab="axe x", ylab="axe y", bty="n",
pch=21, bg="white",
x.minus=x-10, x.plus=x+10)
x <- (1:200)/10
y <- sin(x)
plot_errbar(x=x, y=y, xlab="axe x", ylab="axe y", bty="n", xlim=c(1,20),
y.minus=y-1, y.plus=y+1, ylim=c(-3, 3), type="l",
errbar.y.polygon=TRUE,
errbar.y.polygon.list=list(border=NA, col=rgb(0, 0, 0, 0.5)))
## End(Not run)