bxplot {beeswarm} | R Documentation |
Plot quantile lines
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
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 |
data |
A data.frame (or list) from which the variables in
|
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 |
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. |
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 |
width |
Width of the lines. |
... |
Further arguments passed to |
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
## 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)