gbxp: Draw boxplots from summaries

Description Usage Arguments

View source: R/gplots.R


gbxp draws box plots based on the given summaries in z. It is usually called from within gboxplot but can be invoked directly.


gbxp(z, notch = FALSE, width = NULL, varwidth = FALSE, outline = TRUE,
  notch.frac = 0.5, log = "", border = par("fg"), pars = NULL,
  horizontal = FALSE, add = FALSE, at = NULL, show.names = NULL, ...,
  grid = TRUE, col.grid = "grey90", col.acc = "white")



a list containing data summaries to be used in constructing the plots. These are usually the result of a call to boxplot, but can be generated in any fashion.


if notch is TRUE, a notch is drawn in each side of the boxes. If the notches of two plots do not overlap then the medians are significantly different at the 5 percent level.


a vector giving the relative widths of the boxes making up the plot.


if varwidth is TRUE, the boxes are drawn with widths proportional to the square-roots of the number of observations in the groups.


if outline is not true, the outliers are not drawn.


numeric in (0,1). When notch = TRUE, the fraction of the box width that the notches should use.


character, indicating if any axis should be drawn in logarithmic scale, as in plot.default.


character or numeric (vector), the color of the box borders. Is recycled for multiple boxes. Is used as default for the boxcol, medcol, whiskcol, staplecol, and outcol options (see below).


graphical parameters (etc) can be passed as arguments to this function, either as a list (pars) or normally(...), see the following. (Those in ... take precedence over those in pars.)

Currently, yaxs and ylim are used ‘along the boxplot’, i.e., vertically, when horizontal is false, and xlim horizontally. xaxt, yaxt, las, cex.axis, and col.axis are passed to axis, and main, cex.main, col.main, sub, cex.sub, col.sub, xlab, ylab, cex.lab, and col.lab are passed to title.

In addition, axes is accepted (see plot.window), with default TRUE.

The following arguments (or pars components) allow further customization of the boxplot graphics. Their defaults are typically determined from the non-prefixed version (e.g., boxlty from lty), either from the specified argument or pars component or the corresponding par one.


a scale factor to be applied to all boxes. When there are only a few groups, the appearance of the plot can be improved by making the boxes narrower. The default depends on at and typically is 0.8.

staplewex, outwex:

staple and outlier line width expansion, proportional to box width; both default to 0.5.

boxlty, boxlwd, boxcol, boxfill:

box outline type, width, color, and fill color (which currently defaults to col and will in future default to par("bg")).

medlty, medlwd, medpch, medcex, medcol, medbg:

median line type, line width, point character, point size expansion, color, and background color. The default medpch = NA suppresses the point, and medlty = "blank" does so for the line. Note thatmedlwd defaults to 3x the default lwd.

whisklty, whisklwd, whiskcol:

whisker line type (default: "dashed"), width, and color.

staplelty, staplelwd, staplecol:

staple (= end of whisker) line type, width, and color.

outlty, outlwd, outpch, outcex, outcol, outbg:

outlier line type, line width, point character, point size expansion, color, and background color. The default outlty = "blank" suppresses the lines and outpch = NA suppresses points.


logical indicating if the boxplots should be horizontal; default FALSE means vertical boxes.


logical, if true add boxplot to current plot.


numeric vector giving the locations where the boxplots should be drawn, particularly when add = TRUE; defaults to 1:n where n is the number of boxes.


Set to TRUE or FALSE to override the defaults on whether an x-axis label is printed for each group.


logical; if TRUE, a background grid will be drawn


grid color


grid accent color

raredd/plotr documentation built on Dec. 6, 2018, 6:59 a.m.