EVOLUTION-MANAGER
Edit File: scale_brewer.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: Sequential, diverging and qualitative colour scales from...</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 scale_colour_brewer {ggplot2}"><tr><td>scale_colour_brewer {ggplot2}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Sequential, diverging and qualitative colour scales from colorbrewer.org</h2> <h3>Description</h3> <p>The <code>brewer</code> scales provides sequential, diverging and qualitative colour schemes from ColorBrewer. These are particularly well suited to display discrete values on a map. See <a href="http://colorbrewer2.org">http://colorbrewer2.org</a> for more information. </p> <h3>Usage</h3> <pre> scale_colour_brewer( ..., type = "seq", palette = 1, direction = 1, aesthetics = "colour" ) scale_fill_brewer( ..., type = "seq", palette = 1, direction = 1, aesthetics = "fill" ) scale_colour_distiller( ..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "colour" ) scale_fill_distiller( ..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "fill" ) scale_colour_fermenter( ..., type = "seq", palette = 1, direction = -1, na.value = "grey50", guide = "coloursteps", aesthetics = "colour" ) scale_fill_fermenter( ..., type = "seq", palette = 1, direction = -1, na.value = "grey50", guide = "coloursteps", aesthetics = "fill" ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>Other arguments passed on to <code><a href="discrete_scale.html">discrete_scale()</a></code>, <code><a href="continuous_scale.html">continuous_scale()</a></code>, or <code><a href="binned_scale.html">binned_scale()</a></code>, for <code>brewer</code>, <code>distiller</code>, and <code>fermenter</code> variants respectively, to control name, limits, breaks, labels and so forth.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>One of seq (sequential), div (diverging) or qual (qualitative)</p> </td></tr> <tr valign="top"><td><code>palette</code></td> <td> <p>If a string, will use that named palette. If a number, will index into the list of palettes of appropriate <code>type</code>. The list of available palettes can found in the Palettes section.</p> </td></tr> <tr valign="top"><td><code>direction</code></td> <td> <p>Sets the order of colours in the scale. If 1, the default, colours are as output by <code><a href="../../RColorBrewer/html/ColorBrewer.html">RColorBrewer::brewer.pal()</a></code>. If -1, the order of colours is reversed.</p> </td></tr> <tr valign="top"><td><code>aesthetics</code></td> <td> <p>Character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with. This can be useful, for example, to apply colour settings to the <code>colour</code> and <code>fill</code> aesthetics at the same time, via <code>aesthetics = c("colour", "fill")</code>.</p> </td></tr> <tr valign="top"><td><code>values</code></td> <td> <p>if colours should not be evenly positioned along the gradient this vector gives the position (between 0 and 1) for each colour in the <code>colours</code> vector. See <code><a href="../../scales/html/rescale.html">rescale()</a></code> for a convenience function to map an arbitrary range to between 0 and 1.</p> </td></tr> <tr valign="top"><td><code>space</code></td> <td> <p>colour space in which to calculate gradient. Must be "Lab" - other values are deprecated.</p> </td></tr> <tr valign="top"><td><code>na.value</code></td> <td> <p>Colour to use for missing values</p> </td></tr> <tr valign="top"><td><code>guide</code></td> <td> <p>Type of legend. Use <code>"colourbar"</code> for continuous colour bar, or <code>"legend"</code> for discrete colour legend.</p> </td></tr> </table> <h3>Details</h3> <p>The <code>brewer</code> scales were carefully designed and tested on discrete data. They were not designed to be extended to continuous data, but results often look good. Your mileage may vary. </p> <h3>Palettes</h3> <p>The following palettes are available for use with these scales: </p> <dl> <dt>Diverging</dt><dd><p>BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral</p> </dd> <dt>Qualitative</dt><dd><p>Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3</p> </dd> <dt>Sequential</dt><dd><p>Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd</p> </dd> </dl> <p>Modify the palette through the <code>palette</code> arguement. </p> <h3>Note</h3> <p>The <code>distiller</code> scales extend brewer to continuous scales by smoothly interpolating 7 colours from any palette to a continuous scale. The <code>fermenter</code> scales provide binned versions of the brewer scales. </p> <h3>See Also</h3> <p>Other colour scales: <code><a href="scale_alpha.html">scale_alpha</a>()</code>, <code><a href="scale_gradient.html">scale_colour_gradient</a>()</code>, <code><a href="scale_grey.html">scale_colour_grey</a>()</code>, <code><a href="scale_hue.html">scale_colour_hue</a>()</code>, <code><a href="scale_steps.html">scale_colour_steps</a>()</code>, <code><a href="scale_viridis.html">scale_colour_viridis_d</a>()</code> </p> <h3>Examples</h3> <pre> dsamp <- diamonds[sample(nrow(diamonds), 1000), ] (d <- ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity))) d + scale_colour_brewer() # Change scale label d + scale_colour_brewer("Diamond\nclarity") # Select brewer palette to use, see ?scales::brewer_pal for more details d + scale_colour_brewer(palette = "Greens") d + scale_colour_brewer(palette = "Set1") # scale_fill_brewer works just the same as # scale_colour_brewer but for fill colours p <- ggplot(diamonds, aes(x = price, fill = cut)) + geom_histogram(position = "dodge", binwidth = 1000) p + scale_fill_brewer() # the order of colour can be reversed p + scale_fill_brewer(direction = -1) # the brewer scales look better on a darker background p + scale_fill_brewer(direction = -1) + theme_dark() # Use distiller variant with continous data v <- ggplot(faithfuld) + geom_tile(aes(waiting, eruptions, fill = density)) v v + scale_fill_distiller() v + scale_fill_distiller(palette = "Spectral") # or use blender variants to discretize continuous data v + scale_fill_fermenter() </pre> <hr /><div style="text-align: center;">[Package <em>ggplot2</em> version 3.3.2 <a href="00Index.html">Index</a>]</div> </body></html>