EVOLUTION-MANAGER
Edit File: scale_hue.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: Evenly spaced colours for discrete data</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_hue {ggplot2}"><tr><td>scale_colour_hue {ggplot2}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Evenly spaced colours for discrete data</h2> <h3>Description</h3> <p>Maps each level to an evenly spaced hue on the colour wheel. It does not generate colour-blind safe palettes. </p> <h3>Usage</h3> <pre> scale_colour_hue( ..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0, direction = 1, na.value = "grey50", aesthetics = "colour" ) scale_fill_hue( ..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0, direction = 1, na.value = "grey50", aesthetics = "fill" ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>Arguments passed on to <code><a href="discrete_scale.html">discrete_scale</a></code> </p> <dl> <dt><code>palette</code></dt><dd><p>A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., <code><a href="../../scales/html/hue_pal.html">scales::hue_pal()</a></code>).</p> </dd> <dt><code>breaks</code></dt><dd><p>One of: </p> <ul> <li> <p><code>NULL</code> for no breaks </p> </li> <li> <p><code>waiver()</code> for the default breaks (the scale limits) </p> </li> <li><p> A character vector of breaks </p> </li> <li><p> A function that takes the limits as input and returns breaks as output </p> </li></ul> </dd> <dt><code>limits</code></dt><dd><p>One of: </p> <ul> <li> <p><code>NULL</code> to use the default scale values </p> </li> <li><p> A character vector that defines possible values of the scale and their order </p> </li> <li><p> A function that accepts the existing (automatic) values and returns new ones </p> </li></ul> </dd> <dt><code>drop</code></dt><dd><p>Should unused factor levels be omitted from the scale? The default, <code>TRUE</code>, uses the levels that appear in the data; <code>FALSE</code> uses all the levels in the factor.</p> </dd> <dt><code>na.translate</code></dt><dd><p>Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify <code>na.translate = FALSE</code>.</p> </dd> <dt><code>scale_name</code></dt><dd><p>The name of the scale that should be used for error messages associated with this scale.</p> </dd> <dt><code>name</code></dt><dd><p>The name of the scale. Used as the axis or legend title. If <code>waiver()</code>, the default, the name of the scale is taken from the first mapping used for that aesthetic. If <code>NULL</code>, the legend title will be omitted.</p> </dd> <dt><code>labels</code></dt><dd><p>One of: </p> <ul> <li> <p><code>NULL</code> for no labels </p> </li> <li> <p><code>waiver()</code> for the default labels computed by the transformation object </p> </li> <li><p> A character vector giving labels (must be same length as <code>breaks</code>) </p> </li> <li><p> A function that takes the breaks as input and returns labels as output </p> </li></ul> </dd> <dt><code>expand</code></dt><dd><p>For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function <code><a href="expansion.html">expansion()</a></code> to generate the values for the <code>expand</code> argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.</p> </dd> <dt><code>guide</code></dt><dd><p>A function used to create a guide or its name. See <code><a href="guides.html">guides()</a></code> for more information.</p> </dd> <dt><code>position</code></dt><dd><p>For position scales, The position of the axis. <code>left</code> or <code>right</code> for y axes, <code>top</code> or <code>bottom</code> for x axes.</p> </dd> <dt><code>super</code></dt><dd><p>The super class to use for the constructed scale</p> </dd> </dl> </td></tr> <tr valign="top"><td><code>h</code></td> <td> <p>range of hues to use, in [0, 360]</p> </td></tr> <tr valign="top"><td><code>c</code></td> <td> <p>chroma (intensity of colour), maximum value varies depending on combination of hue and luminance.</p> </td></tr> <tr valign="top"><td><code>l</code></td> <td> <p>luminance (lightness), in [0, 100]</p> </td></tr> <tr valign="top"><td><code>h.start</code></td> <td> <p>hue to start at</p> </td></tr> <tr valign="top"><td><code>direction</code></td> <td> <p>direction to travel around the colour wheel, 1 = clockwise, -1 = counter-clockwise</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>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> </table> <h3>See Also</h3> <p>Other colour scales: <code><a href="scale_alpha.html">scale_alpha</a>()</code>, <code><a href="scale_brewer.html">scale_colour_brewer</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_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))) # Change scale label d + scale_colour_hue() d + scale_colour_hue("clarity") d + scale_colour_hue(expression(clarity[beta])) # Adjust luminosity and chroma d + scale_colour_hue(l = 40, c = 30) d + scale_colour_hue(l = 70, c = 30) d + scale_colour_hue(l = 70, c = 150) d + scale_colour_hue(l = 80, c = 150) # Change range of hues used d + scale_colour_hue(h = c(0, 90)) d + scale_colour_hue(h = c(90, 180)) d + scale_colour_hue(h = c(180, 270)) d + scale_colour_hue(h = c(270, 360)) # Vary opacity # (only works with pdf, quartz and cairo devices) d <- ggplot(dsamp, aes(carat, price, colour = clarity)) d + geom_point(alpha = 0.9) d + geom_point(alpha = 0.5) d + geom_point(alpha = 0.2) # Colour of missing values is controlled with na.value: miss <- factor(sample(c(NA, 1:5), nrow(mtcars), replace = TRUE)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) + scale_colour_hue(na.value = "black") </pre> <hr /><div style="text-align: center;">[Package <em>ggplot2</em> version 3.3.2 <a href="00Index.html">Index</a>]</div> </body></html>