AddIntervals | R Documentation |
Add interval symbols (also known as error bars) to plots.
AddIntervals( x, y0, y1, hin = NULL, col = "black", lty = 1, lwd = 0.7, cex = 1, xpd = FALSE, ..., nondetects = NULL )
x |
'numeric' or 'Date' vector. x coordinate of interval symbols. |
y0 |
'numeric' vector. y coordinate of points from which to draw. |
y1 |
'numeric' vector. y coordinate of points to which to draw. |
hin |
'numeric' number. Horizontal length of an interval head, in inches. |
col, lty, lwd, cex, xpd |
graphical parameters; see |
... |
Additional graphical parameters to the |
nondetects |
'list'.
Overrides graphical parameters used for left- and right-censored data.
Passed arguments include |
For each observation i
, the data type is identified using
(y0[i], Inf)
for right-censored,
y0[i] = y1[i]
for exact, and
(-Inf, y1[i])
for left-censored, and
(y0[i], y1[i])
for interval-censored.
Where infinity may be represented with either Inf
or NA
.
Invisible NULL
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
set.seed(1) x <- stats::runif(12) y <- stats::rnorm(12) plot(x, y) dy <- sort.int(y) / 5 AddIntervals(x, y - dy, y + dy, col = "red", xpd = TRUE) n <- 50 x <- sort.int(stats::runif(n, max = 100)) y1 <- y0 <- stats::runif(n, max = 100) y1[sample.int(n, 5)] <- stats::runif(5, max = 100) y0[sample.int(n, 5)] <- -Inf y1[sample.int(n, 5)] <- Inf ylim <- range(pretty(c(y0, y1))) plot(NA, xlim = range(x), ylim = ylim, xlab = "x", ylab = "y") AddIntervals(x, y0, y1, col = "blue", xpd = TRUE, nondetects = list("col" = "red", "lty" = 2)) print(cbind(x, y0, y1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.