EVOLUTION-MANAGER
Edit File: findColours.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: assign colours to classes from classInterval object</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 findColours {classInt}"><tr><td>findColours {classInt}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>assign colours to classes from classInterval object</h2> <h3>Description</h3> <p>This helper function is a wrapper for <code>findCols</code> to extract classes from a "classInterval" object and assign colours from a palette created by <code>colorRampPalette</code> from the two or more colours given in the <code>pal</code> argument. It also returns two attributes for use in constructing a legend. </p> <h3>Usage</h3> <pre> findColours(clI, pal, under="under", over="over", between="-", digits = getOption("digits"), cutlabels=TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>clI</code></td> <td> <p>a "classIntervals" object</p> </td></tr> <tr valign="top"><td><code>pal</code></td> <td> <p>a character vector of at least two colour names; <code>colorRampPalette</code> is used internally to create the required number of colours</p> </td></tr> <tr valign="top"><td><code>under</code></td> <td> <p>character string value for "under" in legend if cutlabels=FALSE</p> </td></tr> <tr valign="top"><td><code>over</code></td> <td> <p>character string value for "over" in legend if cutlabels=FALSE</p> </td></tr> <tr valign="top"><td><code>between</code></td> <td> <p>character string value for "between" in legend if cutlabels=FALSE</p> </td></tr> <tr valign="top"><td><code>digits</code></td> <td> <p>minimal number of significant digits in legend</p> </td></tr> <tr valign="top"><td><code>cutlabels</code></td> <td> <p>use cut-style labels in legend</p> </td></tr> </table> <h3>Value</h3> <p>a character vector of colours with attributes: "table", a named frequency table; "palette", a character vector of colours corresponding to the specified breaks. </p> <h3>Author(s)</h3> <p>Roger Bivand <Roger.Bivand@nhh.no</p> <h3>See Also</h3> <p><code><a href="classIntervals.html">classIntervals</a></code>, <code><a href="../../base/html/findInterval.html">findInterval</a></code>, <code><a href="findCols.html">findCols</a></code>, <code><a href="../../grDevices/html/colorRamp.html">colorRamp</a></code></p> <h3>Examples</h3> <pre> if (!require("spData", quietly=TRUE)) { message("spData package needed for examples") run <- FALSE } else { run <- TRUE } if (run) { data(jenks71, package="spData") mypal <- c("wheat1", "red3") h5 <- classIntervals(jenks71$jenks71, n=5, style="hclust", method="complete") print(findColours(h5, mypal)) } if (run) { print(findColours(getHclustClassIntervals(h5, k=7), mypal)) } if (run) { h5Colours <- findColours(h5, mypal) plot(h5, mypal, main="Complete hierarchical clustering") legend(c(95, 155), c(0.12, 0.4), fill=attr(h5Colours, "palette"), legend=names(attr(h5Colours, "table")), bg="white") } if (run) { h5tab <- attr(h5Colours, "table") legtext <- paste(names(h5tab), " (", h5tab, ")", sep="") plot(h5, mypal, main="Complete hierarchical clustering (with counts)") legend(c(95, 165), c(0.12, 0.4), fill=attr(h5Colours, "palette"), legend=legtext, bg="white") } </pre> <hr /><div style="text-align: center;">[Package <em>classInt</em> version 0.4-3 <a href="00Index.html">Index</a>]</div> </body></html>