EVOLUTION-MANAGER
Edit File: palette.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: Set or View the Graphics Palette</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 palette {grDevices}"><tr><td>palette {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Set or View the Graphics Palette</h2> <h3>Description</h3> <p>View or manipulate the color palette which is used when a <code>col=</code> has a numeric index. </p> <h3>Usage</h3> <pre> palette(value) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>value</code></td> <td> <p>an optional character vector.</p> </td></tr> </table> <h3>Details</h3> <p>The color palette and referring to colors by number (see e.g. <code><a href="../../graphics/html/par.html">par</a></code>) was provided for compatibility with S: in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> it is almost always better to specify colours by name. </p> <p>If <code>value</code> has length 1, it is taken to be the name of a built-in color palette (only <code>"default"</code> is built-in currently). If <code>value</code> has length greater than 1 it is assumed to contain a description of the colors which are to make up the new palette (either by name or by RGB levels). The maximum size for a palette is 1024 entries. </p> <p>If <code>value</code> is omitted, no change is made to the current palette. </p> <p>There is only one palette setting for all devices in a <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> session. If the palette is changed, the new palette applies to all subsequent plotting. </p> <p>The current palette also applies to re-plotting (for example if an on-screen device is resized or <code><a href="dev2.html">dev.copy</a></code> or <code><a href="recordplot.html">replayPlot</a></code> is used). The palette is recorded on the displaylist at the start of each page and when it is changed. </p> <h3>Value</h3> <p>A character vector giving the palette which <em>was</em> in effect. This is <code><a href="../../base/html/invisible.html">invisible</a></code> unless the argument is omitted. </p> <h3>See Also</h3> <p><code><a href="colors.html">colors</a></code> for the vector of built-in named colors; <code><a href="hsv.html">hsv</a></code>, <code><a href="gray.html">gray</a></code>, <code><a href="palettes.html">rainbow</a></code>, <code><a href="palettes.html">terrain.colors</a></code>, ... to construct colors. </p> <p><code><a href="adjustcolor.html">adjustcolor</a></code>, e.g., for tweaking existing palettes; <code><a href="colorRamp.html">colorRamp</a></code> to interpolate colors, making custom palettes; <code><a href="col2rgb.html">col2rgb</a></code> for translating colors to RGB 3-vectors. </p> <h3>Examples</h3> <pre> require(graphics) palette() # obtain the current palette palette(rainbow(6)) # six color rainbow (palette(gray(seq(0,.9,len = 25)))) # gray scales; print old palette matplot(outer(1:100, 1:30), type = "l", lty = 1,lwd = 2, col = 1:30, main = "Gray Scales Palette", sub = "palette(gray(seq(0, .9, len=25)))") palette("default") # reset back to the default ## on a device where alpha-transparency is supported, ## use 'alpha = 0.3' transparency with the default palette : mycols <- adjustcolor(palette(), alpha.f = 0.3) opal <- palette(mycols) x <- rnorm(1000); xy <- cbind(x, 3*x + rnorm(1000)) plot (xy, lwd = 2, main = "Alpha-Transparency Palette\n alpha = 0.3") xy[,1] <- -xy[,1] points(xy, col = 8, pch = 16, cex = 1.5) palette("default") </pre> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>