Displays box-and-whisker plots of the given (grouped) values.
Usage
# S4 method for class 'LogRatio'
boxplot(
x,
...,
range = 1.5,
width = NULL,
varwidth = FALSE,
notch = FALSE,
outline = TRUE,
plot = TRUE,
horizontal = FALSE,
xlab = NULL,
ylab = NULL,
main = NULL,
sub = NULL,
ann = graphics::par("ann")
)
# S4 method for class 'GroupedLogRatio'
boxplot(
x,
...,
range = 1.5,
width = NULL,
varwidth = FALSE,
notch = FALSE,
outline = TRUE,
plot = TRUE,
horizontal = FALSE,
color = NULL,
xlab = NULL,
ylab = NULL,
main = NULL,
sub = NULL,
ann = graphics::par("ann"),
legend = list(x = "topright")
)Arguments
- x
A
LogRatioobject.- ...
Further graphical parameters.
- range
A length-one
numericvector specifying how far the plot whiskers extend out from the box (seegraphics::boxplot()).- width
A
numericvector giving the relative widths of the boxes making up the plot.- varwidth
A
logicalscalar: should the boxes be drawn with widths proportional to the square-roots of the number of observations in the groups?- notch
A
logicalscalar: should a notch be drawn in each side of the boxes?- outline
A
logicalscalar: should the outliers be drawn?- plot
A
logicalscalar: should a boxplot be produced? IfFALSE, the summaries which the boxplots are based on are invisibly returned.- horizontal
A
logicalscalar: should the boxplots be horizontal?- xlab, ylab
A
charactervector giving the x and y axis labels.- main
A
characterstring giving a main title for the plot.- sub
A
characterstring giving a subtitle for the plot.- ann
A
logicalscalar: should the default annotation (title and x and y axis labels) appear on the plot?- color
A (named) vector of colors (will be mapped to the group names of
object) or afunctionthat when called with a single argument (an integer specifying the number of colors) returns a vector of colors.- legend
A
listof additional arguments to be passed tographics::legend(); names of the list are used as argument names. IfNULL, no legend is displayed.
Value
boxplot() is called for its side-effects: is results in a graphic being
displayed (invisibly return x).
Examples
## Data from Day et al. 2011
data("kommos", package = "folio")
kommos <- remove_NA(kommos, margin = 1) # Remove cases with missing values
coda <- as_composition(kommos, parts = 3:22) # Coerce to compositional data
## Log ratio
clr <- transform_clr(coda)
## Boxplot
boxplot(clr)
## Use ceramic types for grouping
grp <- group(coda, by = kommos$type)
clr <- transform_clr(grp)
boxplot(clr)
