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 color scales</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_color_viridis {viridis}"><tr><td>scale_color_viridis {viridis}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Viridis color scales</h2> <h3>Description</h3> <p>Uses the viridis color scale. </p> <h3>Usage</h3> <pre> scale_color_viridis(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = "D") scale_colour_viridis(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = "D") scale_fill_viridis(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = "D") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>parameters to <code>discrete_scale</code> or <code>scale_fill_gradientn</code></p> </td></tr> <tr valign="top"><td><code>alpha</code></td> <td> <p>pass through parameter to <code>viridis</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 as output by <a href="viridis_pal.html">viridis_pal</a>. If -1, the order of colors is reversed.</p> </td></tr> <tr valign="top"><td><code>discrete</code></td> <td> <p>generate a discrete palette? (default: <code>FALSE</code> - generate continuous palette)</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>For <code>discrete == FALSE</code> (the default) all other arguments are as to <a href="../../ggplot2/html/scale_fill_gradientn.html">scale_fill_gradientn</a> or <a href="../../ggplot2/html/scale_color_gradientn.html">scale_color_gradientn</a>. Otherwise the function will return a <code>discrete_scale</code> with the plot-computed number of colors. </p> <p>See <a href="../../viridisLite/html/viridis.html">viridis</a> for more information on the color scale. </p> <h3>Author(s)</h3> <p>Noam Ross <a href="mailto:noam.ross@gmail.com">noam.ross@gmail.com</a> / <a href="https://twitter.com/noamross">@noamross</a> (continuous version), Bob Rudis <a href="mailto:bob@rud.is">bob@rud.is</a> / <a href="https://twitter.com/hrbrmstr">@hrbrmstr</a> (combined version) </p> <h3>Examples</h3> <pre> library(ggplot2) # ripped from the pages of ggplot2 p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size=4, aes(colour = factor(cyl))) + scale_color_viridis(discrete=TRUE) + theme_bw() # ripped from the pages of ggplot2 dsub <- subset(diamonds, x > 5 & x < 6 & y > 5 & y < 6) dsub$diff <- with(dsub, sqrt(abs(x-y))* sign(x-y)) d <- ggplot(dsub, aes(x, y, colour=diff)) + geom_point() d + scale_color_viridis() + theme_bw() # from the main viridis example dat <- data.frame(x = rnorm(10000), y = rnorm(10000)) ggplot(dat, aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_viridis() + theme_bw() library(ggplot2) library(MASS) library(gridExtra) data("geyser", package="MASS") ggplot(geyser, aes(x = duration, y = waiting)) + xlim(0.5, 6) + ylim(40, 110) + stat_density2d(aes(fill = ..level..), geom="polygon") + theme_bw() + theme(panel.grid=element_blank()) -> gg grid.arrange( gg + scale_fill_viridis(option="A") + labs(x="Virdis A", y=NULL), gg + scale_fill_viridis(option="B") + labs(x="Virdis B", y=NULL), gg + scale_fill_viridis(option="C") + labs(x="Virdis C", y=NULL), gg + scale_fill_viridis(option="D") + labs(x="Virdis D", y=NULL), gg + scale_fill_viridis(option="E") + labs(x="Virdis E", y=NULL), ncol=3, nrow=2 ) </pre> <hr /><div style="text-align: center;">[Package <em>viridis</em> version 0.5.1 <a href="00Index.html">Index</a>]</div> </body></html>