Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

boxplot2

Produce a Boxplot Annotated with the Number of Observations


Description

This funcntion uses boxplot to produce a boxplot which is then annotated with the number of observations in each group.

Usage

boxplot2(..., top=FALSE, shrink=1, textcolor=NULL)

Arguments

...

parameters passed to boxplot.

top

logical indicating whether the number of observations should be added to the top or the bottom of the plotting region. Defaults to FALSE.

shrink

value to shrink character size (cex) when annotating.

textcolor

text color.

Note

This function replaces boxplot.n, which has been deprecated avoid potential problems with S3 method dispatching.

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

Examples

data(state)

# n's at bottom
boxplot2( state.area ~ state.region)

# n's at top
boxplot2( state.area ~ state.region, top=TRUE)

# small red text
boxplot2( state.area ~ state.region, shrink=0.8, textcolor="red")

gplots

Various R Programming Tools for Plotting Data

v3.1.1
GPL-2
Authors
Gregory R. Warnes [aut], Ben Bolker [aut], Lodewijk Bonebakker [aut], Robert Gentleman [aut], Wolfgang Huber [aut], Andy Liaw [aut], Thomas Lumley [aut], Martin Maechler [aut], Arni Magnusson [aut], Steffen Moeller [aut], Marc Schwartz [aut], Bill Venables [aut], Tal Galili [ctb, cre]
Initial release
2020-11-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.