QLines: Plot Quantiles

Description Usage Arguments Functions Examples

Description

Add quantile lines to existing plot. QLines is for long data. QMatLines is for short data.

Usage

1
2
3
4
5
QLines(x, ys, qs = c(0.05, 0.95), mean.lwd = 1, mean.col = rainbow.f(1,
  1), q.col = rainbow.f(1, 1))

QMatLines(x, ys, qs = c(0.05, 0.95), mean.lwd = 1, mean.col = rainbow.f(1,
  1), q.col = rainbow.f(1, 1))

Arguments

x

an array of x variable. For QLines, it should be repeating itself, and for QMatLines, non-repeating.

ys

Either an array or matrix of y variable. For QLines, it should be an array, and for QMatLines, a matrix with columns for iterations.

qs

an array of quantiles. Default at c(0.05,0.95).

mean.lwd

An integer for indicating the width of mean. Default at 1.

mean.col

Color for mean. Default at rainbow.f(1,1).

q.col

Color for quantiles. Default at rainbow.f(1,1).

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Generate a long table
niter <- 100
df <- data.frame("Date"=rep(seq(as.Date("2010-1-1"), by="month", length.out = 12),niter)
, "Iter" = rep(1:niter,each=12), "Y"=rnorm(12*niter))
for (i in 2:nrow(df))if(diff(df$Iter)[i-1]==0) df$Y[i] <- df$Y[i] + df$Y[i-1]

plot(df$Date, df$Y, col=red.f(0.05), pch=19)
QLines(df$Date, df$Y, mean.lwd = 2)

# A short Table
df <- cast(df, Date ~ Iter, value="Y")
QMatLines(df$Date, df[,-1], qs=c(0.25,0.75), q.col=gray.f(0.5))

einaooka/tea.eo.plots documentation built on May 16, 2019, 1:25 a.m.