boxline: Boxline

View source: R/plot2.R

boxlineR Documentation

Boxline

Description

An alternative to boxplot with lines connecting median and quantiles of each box.

Usage

boxline(
  x,
  probs = c(0.75, 0.9, 0.99),
  col.probs = 2L,
  alpha = NULL,
  col.med = 1L,
  lwd.med = 2,
  pch = NULL,
  ylim = NULL,
  err = c("none", "sd", "se", "ci", "quantile"),
  err.alpha = 0.05,
  col.err = col.med,
  lwd.err = lwd.med,
  at = seq_along(x),
  add = FALSE,
  limits = c(-Inf, Inf),
  panel.first = NULL,
  panel.last = NULL,
  ...
)

Arguments

x

a list of vectors

probs

a vector of probabilities; see quantile

col.probs

a vector of colors for each probs, recycled as needed

alpha

optional vector of opacity for each probs; see adjustcolor

col.med, lwd.med

color and line width used for median line

pch

optional plotting character used for the median point of each

ylim

the y-axis limits

err

optional error bars around each median value; possible values are "none" (default), "sd" (standard deviation), "se" (standard error), "ci" (confidence interval), and "quantile" (quantile)

err.alpha

the alpha level used when err is "ci" or "quantile"

col.err, lwd.err

color and line width used for error bars

at

a vector of x-coodinates for each element of x

add

logical; if TRUE, adds to existing plot

limits

optional vector of length two with lower and upper limits for the error bars

panel.first, panel.last

expressions to be evaluated before or after plotting takes place

...

additional arguments passed to boxplot or further to par

Value

See boxplot

Examples

set.seed(1)
x <- lapply(0:10, function(x) rnorm(25, x / 2, sd = 0.5))
boxplot(x)
boxline(x, add = TRUE)

boxline(x, col.probs = c('red', 'orange', 'yellow'), alpha = 0.5,
        pch = 16L, col.med = 'red')
boxline(x, probs = NULL, err = 'sd', add = TRUE, col.err = 'cyan')
boxplot(x, add = TRUE, axes = FALSE, col = 'transparent')


raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.