error_bars | R Documentation |
Insert points and error bars indicating tendency and distribution (error).
This function is using points()
to plot the tendency values and
segments()
for the error bars.
It is also possible to draw just error bars using the option
show.tendency=FALSE
.
error_bars(
tendency,
upper,
lower,
at,
show.tendency = TRUE,
bar.col = "black",
lwd = 1,
lty = 1,
...
)
tendency |
Numeric vector with tendency values (e.g. mean values). |
upper |
Numeric vector with values for upper error intervals. |
lower |
Numeric vector with values for lower error intervals. |
at |
Numeric vector indicating the position for points. |
show.tendency |
Logical value indicating whether points should be drawn or not. |
bar.col |
Color for bars. |
lwd |
Width of bars (see |
lty |
Line type for bars (see |
... |
Further arguments to be passed to |
Miguel Alvarez (malvarez@uni-bonn.de).
data(PlantGrowth)
## Calculation of mean and standard deviation
Growth <- aggregate(weight ~ group, PlantGrowth, mean)
Growth$sd <- aggregate(weight ~ group, PlantGrowth, sd)$weight
## Error bars overlaid to boxplots
boxplot(weight ~ group, data = PlantGrowth, border = "grey", main = "Error Bars")
with(
Growth,
error_bars(tendency = weight, upper = sd, pch = 21, bg = "red", lwd = 2, cex = 1.5)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.