Description Usage Arguments Author(s) Examples
This function is an improved version of polygon
that considers NA values in plotting.
1 2 |
x |
vector of x-values |
lower |
vector of |
upper |
vector of |
col |
color of the polygon |
Matthias Forkel <matthias.forkel@tu-dresden.de> [aut, cre]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | x <- 1:10
med <- rnorm(length(x))
lower <- med - 2
upper <- med + 2
# example 1: no NA values
plot(x, med, type="l", ylim=range(c(lower, upper), na.rm=TRUE))
PolygonNA(x, lower, upper)
lines(x, med)
# example 2: with some NA values
lower1 <- lower
upper1 <- upper
lower1[c(1, 6, 10)] <- NA
upper1[c(1:2, 6)] <- NA
plot(x, med, type="l", ylim=range(c(lower, upper), na.rm=TRUE))
PolygonNA(x, lower1, upper1)
lines(x, med)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.