bxplot: Plot quantile lines

Description Usage Arguments Details Value Examples

Description

Plot lines indicating the specified quantiles for each group. This function is intended as a simplified interpretation of boxplot, which can be combined with a beeswarm (or stripchart) plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bxplot(x, ...)

## S3 method for class 'formula'
bxplot(formula, data = NULL, ..., subset, na.action = NULL)

## Default S3 method:
bxplot(x, probs = c(0.25, 0.5, 0.75),
    vertical = TRUE, horizontal = !vertical, add = FALSE,
    col = par("col"), lty = par("lty"), lwd = NULL, 
    at = NULL, width = 0.75, ...)

Arguments

formula

A formula, such as y ~ grp, where y is a numeric vector of data values to be split into groups according to the grouping variable grp (usually a factor).

data

A data.frame (or list) from which the variables in formula should be taken.

subset

An optional vector specifying a subset of observations to be used.

na.action

A function which indicates what should happen when the data contain NAs. The default is to quietly ignore missing values in either the response or the group.

x

A numeric vector, or a data frame or list of numeric vectors, each of which is considered as a group.

probs

A numeric vector of probabilities with values in [0,1]

vertical, horizontal

Orientation of the plot. horizontal takes precedence if both are specified.

add

Add to an existing plot?

col, lty

Color and line type for each probability.

lwd

Line width for each probability (see below).

at

Numeric vector giving the locations where the swarms should be drawn; defaults to 1:n where n is the number of groups.

width

Width of the lines.

...

Further arguments passed to boxplot.

Details

This function is intended as a minimalistic interpration of boxplot; however, the quantiles plotted by bxplot are not necessarily the same as the hinges plotted by a boxplot.

Notice that specifying a vector of graphical parameters such as lwd or col will refer to each of probs, not to each group in the data (as one might expect by analogy with boxplot).

If lwd is NULL, and if the probs includes 0.5, lwd will be set to 3 times par("lwd") for probs=0.5, and par("lwd") for the others. (Thus something resembling the median line and hinges of a boxplot is produced by default.)

Value

None.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  ## bxplot on bottom
  beeswarm(len ~ dose, data = ToothGrowth)
  bxplot(len ~ dose, data = ToothGrowth, add = TRUE)
  
  ## bxplot on top
  bxplot(decrease ~ treatment, data = OrchardSprays, probs = 0.5, col = 2)
  beeswarm(decrease ~ treatment, data = OrchardSprays, add = TRUE)

  ## Show deciles 
  data(breast)
  bxplot(time_survival ~ event_survival, data = breast, 
    probs = seq(0, 1, by = 0.1), col = rainbow(10))
  beeswarm(time_survival ~ event_survival, data = breast, 
    pch = 21, bg = "gray75", add = TRUE)

Example output



beeswarm documentation built on June 2, 2021, 1:07 a.m.