EVOLUTION-MANAGER
Edit File: densCols.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: Colors for Smooth Density 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 densCols {grDevices}"><tr><td>densCols {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Colors for Smooth Density Plots</h2> <h3>Description</h3> <p><code>densCols</code> produces a vector containing colors which encode the local densities at each point in a scatterplot. </p> <h3>Usage</h3> <pre> densCols(x, y = NULL, nbin = 128, bandwidth, colramp = colorRampPalette(blues9[-(1:3)])) blues9 </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, y</code></td> <td> <p>the <code>x</code> and <code>y</code> arguments provide the x and y coordinates of the points. Any reasonable way of defining the coordinates is acceptable. See the function <code><a href="xy.coords.html">xy.coords</a></code> for details. If supplied separately, they must be of the same length.</p> </td></tr> <tr valign="top"><td><code>nbin</code></td> <td> <p>numeric vector of length one (for both directions) or two (for x and y separately) specifying the number of equally spaced grid points for the density estimation; directly used as <code>gridsize</code> in <code><a href="../../KernSmooth/html/bkde2D.html">bkde2D</a>()</code>.</p> </td></tr> <tr valign="top"><td><code>bandwidth</code></td> <td> <p>numeric vector (length 1 or 2) of smoothing bandwidth(s). If missing, a more or less useful default is used. <code>bandwidth</code> is subsequently passed to function <code><a href="../../KernSmooth/html/bkde2D.html">bkde2D</a></code>.</p> </td></tr> <tr valign="top"><td><code>colramp</code></td> <td> <p>function accepting an integer <code>n</code> as an argument and returning <code>n</code> colors.</p> </td></tr> </table> <h3>Details</h3> <p><code>densCols</code> computes and returns the set of colors that will be used in plotting, calling <code><a href="../../KernSmooth/html/bkde2D.html">bkde2D</a>(*, bandwidth, gridsize = nbin, ..)</code> from package <a href="https://CRAN.R-project.org/package=KernSmooth"><span class="pkg">KernSmooth</span></a>. </p> <p><code>blues9</code> is a set of 9 color shades of blue used as the default in plotting. </p> <h3>Value</h3> <p><code>densCols</code> returns a vector of length <code>nrow(x)</code> that contains colors to be used in a subsequent scatterplot. Each color represents the local density around the corresponding point. </p> <h3>Author(s)</h3> <p>Florian Hahne at FHCRC, originally</p> <h3>See Also</h3> <p><code><a href="../../KernSmooth/html/bkde2D.html">bkde2D</a></code> from package <a href="https://CRAN.R-project.org/package=KernSmooth"><span class="pkg">KernSmooth</span></a>; further, <code><a href="../../graphics/html/smoothScatter.html">smoothScatter</a>()</code> (package <span class="pkg">graphics</span>) which builds on the same computations as <code>densCols</code>. </p> <h3>Examples</h3> <pre> x1 <- matrix(rnorm(1e3), ncol = 2) x2 <- matrix(rnorm(1e3, mean = 3, sd = 1.5), ncol = 2) x <- rbind(x1, x2) dcols <- densCols(x) graphics::plot(x, col = dcols, pch = 20, main = "n = 1000") </pre> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>