EVOLUTION-MANAGER
Edit File: bxp.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Draw Box Plots from Summaries</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for bxp {graphics}"><tr><td>bxp {graphics}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Draw Box Plots from Summaries</h2> <h3>Description</h3> <p><code>bxp</code> draws box plots based on the given summaries in <code>z</code>. It is usually called from within <code><a href="boxplot.html">boxplot</a></code>, but can be invoked directly. </p> <h3>Usage</h3> <pre> bxp(z, notch = FALSE, width = NULL, varwidth = FALSE, outline = TRUE, notch.frac = 0.5, log = "", border = par("fg"), pars = NULL, frame.plot = axes, horizontal = FALSE, ann = TRUE, add = FALSE, at = NULL, show.names = NULL, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>z</code></td> <td> <p>a list containing data summaries to be used in constructing the plots. These are usually the result of a call to <code><a href="boxplot.html">boxplot</a></code>, but can be generated in any fashion.</p> </td></tr> <tr valign="top"><td><code>notch</code></td> <td> <p>if <code>notch</code> is <code>TRUE</code>, 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.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>a vector giving the relative widths of the boxes making up the plot.</p> </td></tr> <tr valign="top"><td><code>varwidth</code></td> <td> <p>if <code>varwidth</code> is <code>TRUE</code>, the boxes are drawn with widths proportional to the square-roots of the number of observations in the groups.</p> </td></tr> <tr valign="top"><td><code>outline</code></td> <td> <p>if <code>outline</code> is not true, the outliers are not drawn.</p> </td></tr> <tr valign="top"><td><code>notch.frac</code></td> <td> <p>numeric in (0,1). When <code>notch = TRUE</code>, the fraction of the box width that the notches should use.</p> </td></tr> <tr valign="top"><td><code>border</code></td> <td> <p>character or numeric (vector), the color of the box borders. Is recycled for multiple boxes. Is used as default for the <code>boxcol</code>, <code>medcol</code>, <code>whiskcol</code>, <code>staplecol</code>, and <code>outcol</code> options (see below). </p> </td></tr> <tr valign="top"><td><code>log</code></td> <td> <p>character, indicating if any axis should be drawn in logarithmic scale, as in <code><a href="plot.default.html">plot.default</a></code>.</p> </td></tr> <tr valign="top"><td><code>frame.plot</code></td> <td> <p>logical, indicating if a ‘frame’ (<code><a href="box.html">box</a></code>) should be drawn; defaults to <code>TRUE</code>, unless <code>axes = FALSE</code> is specified.</p> </td></tr> <tr valign="top"><td><code>horizontal</code></td> <td> <p>logical indicating if the boxplots should be horizontal; default <code>FALSE</code> means vertical boxes.</p> </td></tr> <tr valign="top"><td><code>ann</code></td> <td> <p>a logical value indicating whether the default annotation (title and x and y axis labels) should appear on the plot.</p> </td></tr> <tr valign="top"><td><code>add</code></td> <td> <p>logical, if true <em>add</em> boxplot to current plot.</p> </td></tr> <tr valign="top"><td><code>at</code></td> <td> <p>numeric vector giving the locations where the boxplots should be drawn, particularly when <code>add = TRUE</code>; defaults to <code>1:n</code> where <code>n</code> is the number of boxes.</p> </td></tr> <tr valign="top"><td><code>show.names</code></td> <td> <p>Set to <code>TRUE</code> or <code>FALSE</code> to override the defaults on whether an x-axis label is printed for each group.</p> </td></tr> <tr valign="top"><td><code>pars,...</code></td> <td> <p><a href="par.html">graphical parameters</a> (etc) can be passed as arguments to this function, either as a list (<code>pars</code>) or normally(<code>...</code>), see the following. (Those in <code>...</code> take precedence over those in <code>pars</code>.) </p> <p>Currently, <code>yaxs</code> and <code>ylim</code> are used ‘along the boxplot’, i.e., vertically, when <code>horizontal</code> is false, and <code>xlim</code> horizontally. <code>xaxt</code>, <code>yaxt</code>, <code>las</code>, <code>cex.axis</code>, and <code>col.axis</code> are passed to <code><a href="axis.html">axis</a></code>, and <code>main</code>, <code>cex.main</code>, <code>col.main</code>, <code>sub</code>, <code>cex.sub</code>, <code>col.sub</code>, <code>xlab</code>, <code>ylab</code>, <code>cex.lab</code>, and <code>col.lab</code> are passed to <code><a href="title.html">title</a></code>. </p> <p>In addition, <code>axes</code> is accepted (see <code><a href="plot.window.html">plot.window</a></code>), with default <code>TRUE</code>. </p> <p>The following arguments (or <code>pars</code> components) allow further customization of the boxplot graphics. Their defaults are typically determined from the non-prefixed version (e.g., <code>boxlty</code> from <code>lty</code>), either from the specified argument or <code>pars</code> component or the corresponding <code><a href="par.html">par</a></code> one. </p> <dl> <dt>boxwex:</dt><dd><p>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 <code>at</code> and typically is <i>0.8</i>.</p> </dd> <dt>staplewex, outwex:</dt><dd><p>staple and outlier line width expansion, proportional to box width; both default to 0.5.</p> </dd> <dt>boxlty, boxlwd, boxcol, boxfill:</dt><dd><p>box outline type, width, color, and fill color (which currently defaults to <code>col</code> and will in future default to <code>par("bg")</code>).</p> </dd> <dt>medlty, medlwd, medpch, medcex, medcol, medbg:</dt><dd><p>median line type, line width, point character, point size expansion, color, and background color. The default <code>medpch = NA</code> suppresses the point, and <code>medlty = "blank"</code> does so for the line. Note that<code>medlwd</code> defaults to <i>3x</i> the default <code>lwd</code>.</p> </dd> <dt>whisklty, whisklwd, whiskcol:</dt><dd><p>whisker line type (default: <code>"dashed"</code>), width, and color.</p> </dd> <dt>staplelty, staplelwd, staplecol:</dt><dd><p>staple (= end of whisker) line type, width, and color.</p> </dd> <dt>outlty, outlwd, outpch, outcex, outcol, outbg:</dt><dd><p>outlier line type, line width, point character, point size expansion, color, and background color. The default <code>outlty = "blank"</code> suppresses the lines and <code>outpch = NA</code> suppresses points.</p> </dd> </dl> </td></tr></table> <h3>Value</h3> <p>An invisible vector, actually identical to the <code>at</code> argument, with the coordinates ("x" if horizontal is false, "y" otherwise) of box centers, useful for adding to the plot. </p> <h3>Note</h3> <p>When <code>add = FALSE</code>, <code>xlim</code> now defaults to <code>xlim = range(at, *) + c(-0.5, 0.5)</code>. It will usually be a good idea to specify <code>xlim</code> if the "x" axis has a log scale or <code>width</code> is far from uniform. </p> <h3>Author(s)</h3> <p>The R Core development team and Arni Magnusson (then at U Washington) who has provided most changes for the box*, med*, whisk*, staple*, and out* arguments. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>Examples</h3> <pre> require(stats) set.seed(753) (bx.p <- boxplot(split(rt(100, 4), gl(5, 20)))) op <- par(mfrow = c(2, 2)) bxp(bx.p, xaxt = "n") bxp(bx.p, notch = TRUE, axes = FALSE, pch = 4, boxfill = 1:5) bxp(bx.p, notch = TRUE, boxfill = "lightblue", frame = FALSE, outl = FALSE, main = "bxp(*, frame= FALSE, outl= FALSE)") bxp(bx.p, notch = TRUE, boxfill = "lightblue", border = 2:6, ylim = c(-4,4), pch = 22, bg = "green", log = "x", main = "... log = 'x', ylim = *") par(op) op <- par(mfrow = c(1, 2)) ## single group -- no label boxplot (weight ~ group, data = PlantGrowth, subset = group == "ctrl") ## with label bx <- boxplot(weight ~ group, data = PlantGrowth, subset = group == "ctrl", plot = FALSE) bxp(bx, show.names=TRUE) par(op) z <- split(rnorm(1000), rpois(1000, 2.2)) boxplot(z, whisklty = 3, main = "boxplot(z, whisklty = 3)") ## Colour support similar to plot.default: op <- par(mfrow = 1:2, bg = "light gray", fg = "midnight blue") boxplot(z, col.axis = "skyblue3", main = "boxplot(*, col.axis=..,main=..)") plot(z[[1]], col.axis = "skyblue3", main = "plot(*, col.axis=..,main=..)") mtext("par(bg=\"light gray\", fg=\"midnight blue\")", outer = TRUE, line = -1.2) par(op) ## Mimic S-Plus: splus <- list(boxwex = 0.4, staplewex = 1, outwex = 1, boxfill = "grey40", medlwd = 3, medcol = "white", whisklty = 3, outlty = 1, outpch = NA) boxplot(z, pars = splus) ## Recycled and "sweeping" parameters op <- par(mfrow = c(1,2)) boxplot(z, border = 1:5, lty = 3, medlty = 1, medlwd = 2.5) boxplot(z, boxfill = 1:3, pch = 1:5, lwd = 1.5, medcol = "white") par(op) ## too many possibilities boxplot(z, boxfill = "light gray", outpch = 21:25, outlty = 2, bg = "pink", lwd = 2, medcol = "dark blue", medcex = 2, medpch = 20) </pre> <hr /><div style="text-align: center;">[Package <em>graphics</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>