addErrorBars: Errors Bars

View source: R/addErrorBars.R

addErrorBarsR Documentation

Errors Bars

Description

Adds upper-lower error bars to data in a graph.

Usage

addErrorBars(x, yup, ylo, Bars = list(name = "", cap = 0.09, width =
  "standard", color = "black"), current = list(yaxis.log = FALSE,
  yaxis.rev = FALSE, xaxis.log = FALSE))

Arguments

x

the x-coordinate data. Missing values are permitted but result in no bar.

yup

the upper limit of the error bar. Missing values are permitted but result in no bar.

ylo

the lower limit of the error bar. Missing values are permitted but result in no bar.

Bars

parameters defining the characteristics of the error bars. See Details.

current

the current plot information. Typically, this would be the output from one of the graph creation functions like xyPlot.

Details

The Bars argument must be a tagged list with these components:

name

a name describing the data; used in the explanation.

cap

the width of each cap on the error bar.

width

the width of the lines drawn for the error bars.

color

the name of the color to draw the error bars.

Value

The current plot information is returned invisibly.

Note

The error bars are plotted on top of any current symbol. To plot the symbol on top of the error bar, start with the argument Plot=list(what="none") in the original call to xyPlot or timePlot and then add the symbols with a call to addXY. Note that this is only necessary if the color of the symbol and the color of the error bars are different.
The symbol drawn for errors bars in the explantion does not have caps due to a limitation in the system for creating the explanation.

See Also

xyPlot, timePlot, addXY, xyPlot

Examples

## Not run: 
set.seed(1)
X <- seq(1, 9, by=1.0)
Y1 <- runif(9)
Y2 <- runif(9)
Y <- (Y1 + Y2)/2
Ymin <- pmin(Y1, Y2)
Ymax <- pmax(Y1, Y2)
setGD()
AA.pl <- xyPlot(X, Y, yaxis.range=c(0,1))
addErrorBars(X,Ymax, Ymin)
# For more details of addErrorBars see 
vignette(topic="GraphGallery", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.