EVOLUTION-MANAGER
Edit File: level.colors.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: A function to compute false colors representing a numeric or...</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 D_level.colors {lattice}"><tr><td>D_level.colors {lattice}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> A function to compute false colors representing a numeric or categorical variable </h2> <h3>Description</h3> <p>Calculates false colors from a numeric variable (including factors, using their numeric codes) given a color scheme and breakpoints. </p> <h3>Usage</h3> <pre> level.colors(x, at, col.regions, colors = TRUE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p> A numeric or <code><a href="../../base/html/factor.html">factor</a></code> variable. </p> </td></tr> <tr valign="top"><td><code>at</code></td> <td> <p> A numeric variable of breakpoints defining intervals along the range of <code>x</code>. </p> </td></tr> <tr valign="top"><td><code>col.regions</code></td> <td> <p> A specification of the colors to be assigned to each interval defined by <code>at</code>. This could be either a vector of colors, or a function that produces a vector of colors when called with a single argument giving the number of colors. See details below. </p> </td></tr> <tr valign="top"><td><code>colors</code></td> <td> <p> logical indicating whether colors should be computed and returned. If <code>FALSE</code>, only the indices representing which interval (among those defined by <code>at</code>) each value in <code>x</code> falls into is returned. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> Extra arguments, ignored. </p> </td></tr> </table> <h3>Details</h3> <p>If <code>at</code> has length n, then it defines n-1 intervals. Values of <code>x</code> outside the range of <code>at</code> are not assigned to an interval, and the return value is <code>NA</code> for such values. </p> <p>Colors are chosen by assigning a color to each of the n-1 intervals. If <code>col.regions</code> is a palette function (such as <code><a href="../../grDevices/html/palettes.html">topo.colors</a></code>, or the result of calling <code><a href="../../grDevices/html/colorRamp.html">colorRampPalette</a></code>), it is called with n-1 as an argument to obtain the colors. Otherwise, if there are exactly n-1 colors in <code>col.regions</code>, these get assigned to the intervals. If there are fewer than n-1 colors, <code>col.regions</code> gets recycled. If there are more, a more or less equally spaced (along the length of <code>col.regions</code>) subset is chosen. </p> <h3>Value</h3> <p>A vector of the same length as <code>x</code>. Depending on the <code>colors</code> argument, this could be either a vector of colors (in a form usable by <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>), or a vector of integer indices representing which interval the values of <code>x</code> fall in. </p> <h3>Author(s)</h3> <p> Deepayan Sarkar <a href="mailto:deepayan.sarkar@r-project.org">deepayan.sarkar@r-project.org</a> </p> <h3>See Also</h3> <p><code><a href="levelplot.html">levelplot</a></code>, <code><a href="../../grDevices/html/colorRamp.html">colorRampPalette</a></code>. </p> <h3>Examples</h3> <pre> depth.col <- with(quakes, level.colors(depth, at = do.breaks(range(depth), 30), col.regions = terrain.colors)) xyplot(lat ~ long | equal.count(stations), quakes, strip = strip.custom(var.name = "Stations"), colours = depth.col, panel = function(x, y, colours, subscripts, ...) { panel.xyplot(x, y, pch = 21, col = "transparent", fill = colours[subscripts], ...) }) </pre> <hr /><div style="text-align: center;">[Package <em>lattice</em> version 0.20-38 <a href="00Index.html">Index</a>]</div> </body></html>