EVOLUTION-MANAGER
Edit File: scale_viridis.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: Viridis colour scales from viridisLite</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_viridis_d {ggplot2}"><tr><td>scale_colour_viridis_d {ggplot2}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Viridis colour scales from viridisLite</h2> <h3>Description</h3> <p>The <code>viridis</code> scales provide colour maps that are perceptually uniform in both colour and black-and-white. They are also designed to be perceived by viewers with common forms of colour blindness. See also <a href="https://bids.github.io/colormap/">https://bids.github.io/colormap/</a>. </p> <h3>Usage</h3> <pre> scale_colour_viridis_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", aesthetics = "colour" ) scale_fill_viridis_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", aesthetics = "fill" ) scale_colour_viridis_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "colour" ) scale_fill_viridis_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "fill" ) scale_colour_viridis_b( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", values = NULL, space = "Lab", na.value = "grey50", guide = "coloursteps", aesthetics = "colour" ) scale_fill_viridis_b( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "D", values = NULL, space = "Lab", 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 <a href="binned_scale.html">binned_scale</a> to control name, limits, breaks, labels and so forth.</p> </td></tr> <tr valign="top"><td><code>alpha</code></td> <td> <p>The alpha transparency, a number in [0,1], see argument alpha in <code><a href="../../grDevices/html/hsv.html">hsv</a></code>.</p> </td></tr> <tr valign="top"><td><code>begin</code></td> <td> <p>The (corrected) hue in [0,1] at which the viridis colormap begins.</p> </td></tr> <tr valign="top"><td><code>end</code></td> <td> <p>The (corrected) hue in [0,1] at which the viridis colormap ends.</p> </td></tr> <tr valign="top"><td><code>direction</code></td> <td> <p>Sets the order of colors in the scale. If 1, the default, colors are ordered from darkest to lightest. If -1, the order of colors is reversed.</p> </td></tr> <tr valign="top"><td><code>option</code></td> <td> <p>A character string indicating the colormap option to use. Four options are available: "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D", the default option) and "cividis" (or "E").</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>Missing values will be replaced with this value.</p> </td></tr> <tr valign="top"><td><code>guide</code></td> <td> <p>A function used to create a guide or its name. See <code><a href="guides.html">guides()</a></code> for more information.</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_hue.html">scale_colour_hue</a>()</code>, <code><a href="scale_steps.html">scale_colour_steps</a>()</code> </p> <h3>Examples</h3> <pre> # viridis is the default colour/fill scale for ordered factors dsamp <- diamonds[sample(nrow(diamonds), 1000), ] ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity)) # Use viridis_d with discrete data txsamp <- subset(txhousing, city %in% c("Houston", "Fort Worth", "San Antonio", "Dallas", "Austin")) (d <- ggplot(data = txsamp, aes(x = sales, y = median)) + geom_point(aes(colour = city))) d + scale_colour_viridis_d() # Change scale label d + scale_colour_viridis_d("City\nCenter") # Select palette to use, see ?scales::viridis_pal for more details d + scale_colour_viridis_d(option = "plasma") d + scale_colour_viridis_d(option = "inferno") # scale_fill_viridis_d works just the same as # scale_colour_viridis_d but for fill colours p <- ggplot(txsamp, aes(x = median, fill = city)) + geom_histogram(position = "dodge", binwidth = 15000) p + scale_fill_viridis_d() # the order of colour can be reversed p + scale_fill_viridis_d(direction = -1) # Use viridis_c with continous data (v <- ggplot(faithfuld) + geom_tile(aes(waiting, eruptions, fill = density))) v + scale_fill_viridis_c() v + scale_fill_viridis_c(option = "plasma") # Use viridis_b to bin continuous data before mapping v + scale_fill_viridis_b() </pre> <hr /><div style="text-align: center;">[Package <em>ggplot2</em> version 3.3.2 <a href="00Index.html">Index</a>]</div> </body></html>