EVOLUTION-MANAGER
Edit File: coplot.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: Conditioning Plots</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 coplot {graphics}"><tr><td>coplot {graphics}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Conditioning Plots</h2> <h3>Description</h3> <p>This function produces two variants of the <b>co</b>nditioning plots discussed in the reference below. </p> <h3>Usage</h3> <pre> coplot(formula, data, given.values, panel = points, rows, columns, show.given = TRUE, col = par("fg"), pch = par("pch"), bar.bg = c(num = gray(0.8), fac = gray(0.95)), xlab = c(x.name, paste("Given :", a.name)), ylab = c(y.name, paste("Given :", b.name)), subscripts = FALSE, axlabels = function(f) abbreviate(levels(f)), number = 6, overlap = 0.5, xlim, ylim, ...) co.intervals(x, number = 6, overlap = 0.5) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>formula</code></td> <td> <p>a formula describing the form of conditioning plot. A formula of the form <code>y ~ x | a</code> indicates that plots of <code>y</code> versus <code>x</code> should be produced conditional on the variable <code>a</code>. A formula of the form <code>y ~ x| a * b</code> indicates that plots of <code>y</code> versus <code>x</code> should be produced conditional on the two variables <code>a</code> and <code>b</code>. </p> <p>All three or four variables may be either numeric or factors. When <code>x</code> or <code>y</code> are factors, the result is almost as if <code>as.numeric()</code> was applied, whereas for factor <code>a</code> or <code>b</code>, the conditioning (and its graphics if <code>show.given</code> is true) are adapted. </p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>a data frame containing values for any variables in the formula. By default the environment where <code>coplot</code> was called from is used.</p> </td></tr> <tr valign="top"><td><code>given.values</code></td> <td> <p>a value or list of two values which determine how the conditioning on <code>a</code> and <code>b</code> is to take place. </p> <p>When there is no <code>b</code> (i.e., conditioning only on <code>a</code>), usually this is a matrix with two columns each row of which gives an interval, to be conditioned on, but is can also be a single vector of numbers or a set of factor levels (if the variable being conditioned on is a factor). In this case (no <code>b</code>), the result of <code>co.intervals</code> can be used directly as <code>given.values</code> argument. </p> </td></tr> <tr valign="top"><td><code>panel</code></td> <td> <p>a <code><a href="../../base/html/function.html">function</a>(x, y, col, pch, ...)</code> which gives the action to be carried out in each panel of the display. The default is <code>points</code>.</p> </td></tr> <tr valign="top"><td><code>rows</code></td> <td> <p>the panels of the plot are laid out in a <code>rows</code> by <code>columns</code> array. <code>rows</code> gives the number of rows in the array.</p> </td></tr> <tr valign="top"><td><code>columns</code></td> <td> <p>the number of columns in the panel layout array.</p> </td></tr> <tr valign="top"><td><code>show.given</code></td> <td> <p>logical (possibly of length 2 for 2 conditioning variables): should conditioning plots be shown for the corresponding conditioning variables (default <code>TRUE</code>).</p> </td></tr> <tr valign="top"><td><code>col</code></td> <td> <p>a vector of colors to be used to plot the points. If too short, the values are recycled.</p> </td></tr> <tr valign="top"><td><code>pch</code></td> <td> <p>a vector of plotting symbols or characters. If too short, the values are recycled.</p> </td></tr> <tr valign="top"><td><code>bar.bg</code></td> <td> <p>a named vector with components <code>"num"</code> and <code>"fac"</code> giving the background colors for the (shingle) bars, for <b>num</b>eric and <b>fac</b>tor conditioning variables respectively.</p> </td></tr> <tr valign="top"><td><code>xlab</code></td> <td> <p>character; labels to use for the x axis and the first conditioning variable. If only one label is given, it is used for the x axis and the default label is used for the conditioning variable.</p> </td></tr> <tr valign="top"><td><code>ylab</code></td> <td> <p>character; labels to use for the y axis and any second conditioning variable.</p> </td></tr> <tr valign="top"><td><code>subscripts</code></td> <td> <p>logical: if true the panel function is given an additional (third) argument <code>subscripts</code> giving the subscripts of the data passed to that panel.</p> </td></tr> <tr valign="top"><td><code>axlabels</code></td> <td> <p>function for creating axis (tick) labels when x or y are factors.</p> </td></tr> <tr valign="top"><td><code>number</code></td> <td> <p>integer; the number of conditioning intervals, for a and b, possibly of length 2. It is only used if the corresponding conditioning variable is not a <code><a href="../../base/html/factor.html">factor</a></code>.</p> </td></tr> <tr valign="top"><td><code>overlap</code></td> <td> <p>numeric < 1; the fraction of overlap of the conditioning variables, possibly of length 2 for x and y direction. When overlap < 0, there will be <em>gaps</em> between the data slices.</p> </td></tr> <tr valign="top"><td><code>xlim</code></td> <td> <p>the range for the x axis.</p> </td></tr> <tr valign="top"><td><code>ylim</code></td> <td> <p>the range for the y axis.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments to the panel function.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>a numeric vector.</p> </td></tr> </table> <h3>Details</h3> <p>In the case of a single conditioning variable <code>a</code>, when both <code>rows</code> and <code>columns</code> are unspecified, a ‘close to square’ layout is chosen with <code>columns >= rows</code>. </p> <p>In the case of multiple <code>rows</code>, the <em>order</em> of the panel plots is from the bottom and from the left (corresponding to increasing <code>a</code>, typically). </p> <p>A panel function should not attempt to start a new plot, but just plot within a given coordinate system: thus <code>plot</code> and <code>boxplot</code> are not panel functions. </p> <p>The rendering of arguments <code>xlab</code> and <code>ylab</code> is not controlled by <code><a href="par.html">par</a></code> arguments <code>cex.lab</code> and <code>font.lab</code> even though they are plotted by <code><a href="mtext.html">mtext</a></code> rather than <code><a href="title.html">title</a></code>. </p> <h3>Value</h3> <p><code>co.intervals(., number, .)</code> returns a (<code>number</code> <i>x</i> 2) <code><a href="../../base/html/matrix.html">matrix</a></code>, say <code>ci</code>, where <code>ci[k,]</code> is the <code><a href="../../base/html/range.html">range</a></code> of <code>x</code> values for the <code>k</code>-th interval. </p> <h3>References</h3> <p>Chambers, J. M. (1992) <em>Data for models.</em> Chapter 3 of <em>Statistical Models in S</em> eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole. </p> <p>Cleveland, W. S. (1993) <em>Visualizing Data.</em> New Jersey: Summit Press. </p> <h3>See Also</h3> <p><code><a href="pairs.html">pairs</a></code>, <code><a href="panel.smooth.html">panel.smooth</a></code>, <code><a href="points.html">points</a></code>. </p> <h3>Examples</h3> <pre> ## Tonga Trench Earthquakes coplot(lat ~ long | depth, data = quakes) given.depth <- co.intervals(quakes$depth, number = 4, overlap = .1) coplot(lat ~ long | depth, data = quakes, given.v = given.depth, rows = 1) ## Conditioning on 2 variables: ll.dm <- lat ~ long | depth * mag coplot(ll.dm, data = quakes) coplot(ll.dm, data = quakes, number = c(4, 7), show.given = c(TRUE, FALSE)) coplot(ll.dm, data = quakes, number = c(3, 7), overlap = c(-.5, .1)) # negative overlap DROPS values ## given two factors Index <- seq(length = nrow(warpbreaks)) # to get nicer default labels coplot(breaks ~ Index | wool * tension, data = warpbreaks, show.given = 0:1) coplot(breaks ~ Index | wool * tension, data = warpbreaks, col = "red", bg = "pink", pch = 21, bar.bg = c(fac = "light blue")) ## Example with empty panels: with(data.frame(state.x77), { coplot(Life.Exp ~ Income | Illiteracy * state.region, number = 3, panel = function(x, y, ...) panel.smooth(x, y, span = .8, ...)) ## y ~ factor -- not really sensible, but 'show off': coplot(Life.Exp ~ state.region | Income * state.division, panel = panel.smooth) }) </pre> <hr /><div style="text-align: center;">[Package <em>graphics</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>