EVOLUTION-MANAGER
Edit File: 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: Matplotlib 'viridis' and 'cividis' color map</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 viridis {viridisLite}"><tr><td>viridis {viridisLite}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Matplotlib 'viridis' and 'cividis' color map</h2> <h3>Description</h3> <p>This function creates a vector of <code>n</code> equally spaced colors along the Matplolib 'viridis' color map created by <a href="https://github.com/stefanv">Stéfan van der Walt</a> and <a href="https://github.com/njsmith">Nathaniel Smith</a>. This color map is designed in such a way that it will analytically be perfectly perceptually-uniform, both in regular form and also when converted to black-and-white. It is also designed to be perceived by readers with the most common form of color blindness. </p> <h3>Usage</h3> <pre> viridis(n, alpha = 1, begin = 0, end = 1, direction = 1, option = "D") viridisMap(n = 256, alpha = 1, begin = 0, end = 1, direction = 1, option = "D") magma(n, alpha = 1, begin = 0, end = 1, direction = 1) inferno(n, alpha = 1, begin = 0, end = 1, direction = 1) plasma(n, alpha = 1, begin = 0, end = 1, direction = 1) cividis(n, alpha = 1, begin = 0, end = 1, direction = 1) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>n</code></td> <td> <p>The number of colors (<i>≥ 1</i>) to be in the palette.</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> </table> <h3>Details</h3> <p>A corrected version of 'viridis', 'cividis', was developed by <a href="https://github.com/jamienunez">Jamie R. Nuñez</a> and <a href="https://github.com/smcolby">Sean M. Colby</a>. It is optimal for viewing by those with color vision deficiency. 'cividis' is designed to be perfectly perceptually-uniform, both in regular form and also when converted to black-and-white, and can be perceived by readers with all forms of color blindness. </p> <p>Here are the color scales: </p> <div style="text-align: center"><p><img src="../help/figures/viridis-scales.png" style="width:750px;max-width:90%;" /></div> </p> <p><code>magma()</code>, <code>plasma()</code>, <code>inferno()</code> and <code>cividis()</code> are convenience functions for the other colormap options, which are useful the scale must be passed as a function name. </p> <p>Semi-transparent colors (<i>0 < alpha < 1</i>) are supported only on some devices: see <code><a href="../../grDevices/html/rgb.html">rgb</a></code>. </p> <h3>Value</h3> <p><code>viridis</code> returns a character vector, <code>cv</code>, of color hex codes. This can be used either to create a user-defined color palette for subsequent graphics by <code>palette(cv)</code>, a <code>col =</code> specification in graphics functions or in <code>par</code>. </p> <p><code>viridisMap</code> returns a <code>n</code> lines data frame containing the red (<code>R</code>), green (<code>G</code>), blue (<code>B</code>) and alpha (<code>alpha</code>) channels of <code>n</code> equally spaced colors along the 'viridis' color map. <code>n = 256</code> by default, which corresponds to the data from the original 'viridis' color map in Matplotlib. </p> <h3>Author(s)</h3> <p>Simon Garnier: <a href="mailto:garnier@njit.edu">garnier@njit.edu</a>, <a href="https://twitter.com/sjmgarnier">@sjmgarnier</a> </p> <h3>Examples</h3> <pre> library(ggplot2) library(hexbin) dat <- data.frame(x = rnorm(10000), y = rnorm(10000)) ggplot(dat, aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_gradientn(colours = viridis(256, option = "D")) # using code from RColorBrewer to demo the palette n = 200 image( 1:n, 1, as.matrix(1:n), col = viridis(n, option = "D"), xlab = "viridis n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" ) </pre> <hr /><div style="text-align: center;">[Package <em>viridisLite</em> version 0.3.0 <a href="00Index.html">Index</a>]</div> </body></html>