diff --git a/NAMESPACE b/NAMESPACE index 2fd3882..86effab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,15 +8,6 @@ export(chart_theme) export(combine_charts) export(f_aes) export(ggarrange) -export(scale_color_continuous) -export(scale_color_viridis_c) -export(scale_color_viridis_d) -export(scale_colour_continuous) -export(scale_colour_viridis_c) -export(scale_colour_viridis_d) -export(scale_fill_continuous) -export(scale_fill_viridis_c) -export(scale_fill_viridis_d) export(theme_sciviews) export(theme_sciviews_graphics) export(theme_sciviews_lattice) @@ -42,6 +33,7 @@ importFrom(rlang,abort) importFrom(rlang,f_env) importFrom(rlang,f_lhs) importFrom(rlang,f_rhs) +importFrom(rlang,is_quosure) importFrom(rlang,is_true) importFrom(rlang,warn) importFrom(scales,gradient_n_pal) diff --git a/R/chart-package.R b/R/chart-package.R index 304beb1..c3d5f8f 100644 --- a/R/chart-package.R +++ b/R/chart-package.R @@ -20,7 +20,7 @@ #' @importFrom viridis viridis_pal #' @importFrom scales hue_pal gradient_n_pal #' @importFrom cowplot theme_cowplot -#' @importFrom rlang abort warn f_env f_lhs f_rhs is_true +#' @importFrom rlang abort warn f_env f_lhs f_rhs is_true is_quosure #' @importFrom stats as.formula asOneSidedFormula #' @importFrom utils modifyList #' @importFrom pryr modify_lang diff --git a/man/viridis.Rd b/man/viridis.Rd deleted file mode 100644 index 218c690..0000000 --- a/man/viridis.Rd +++ /dev/null @@ -1,118 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/chart_theme.R -\name{viridis} -\alias{viridis} -\alias{scale_colour_viridis_c} -\alias{scale_color_viridis_c} -\alias{scale_colour_viridis_d} -\alias{scale_color_viridis_d} -\alias{scale_fill_viridis_c} -\alias{scale_fill_viridis_d} -\alias{scale_colour_continuous} -\alias{scale_color_continuous} -\alias{scale_fill_continuous} -\title{Viridis color scales} -\usage{ -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_color_viridis_c(..., alpha = 1, begin = 0, end = 1, - direction = 1, option = "D", values = NULL, space = "Lab", - na.value = "grey50", guide = "colourbar", aesthetics = "colour") - -scale_colour_viridis_d(..., alpha = 1, begin = 0, end = 1, - direction = 1, option = "D", aesthetics = "colour") - -scale_color_viridis_d(..., alpha = 1, begin = 0, end = 1, - direction = 1, option = "D", 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_fill_viridis_d(..., alpha = 1, begin = 0, end = 1, - direction = 1, option = "D", aesthetics = "fill") - -scale_colour_continuous(..., - type = getOption("ggplot2.continuous.colour", default = "gradient")) - -scale_color_continuous(..., type = getOption("ggplot2.continuous.colour", - default = "gradient")) - -scale_fill_continuous(..., type = getOption("ggplot2.continuous.fill", - default = "gradient")) -} -\arguments{ -\item{...}{Other arguments passed on to \code{\link[=discrete_scale]{discrete_scale()}} or -\code{\link[=continuous_scale]{continuous_scale()}} to control name, limits, breaks, labels and so forth.} - -\item{alpha}{The alpha transparency, a number in \code{[0,1]}, see argument alpha -in hsv.} - -\item{begin}{The (corrected) hue in \code{[0,1]} at which the viridis colormap -begins.} - -\item{end}{The (corrected) hue in \code{[0,1]} at which the viridis colormap ends.} - -\item{direction}{Sets the order of colors in the scale. If \code{1}, the default, -colors are ordered from darkest to lightest. If \code{-1}, the order of colors is -reversed.} - -\item{option}{A character string indicating the colormap option to use. Four -options are available: \code{"magma"} (or \code{"A"}), \code{"inferno"} (or \code{"B"}), -\code{"plasma"} (or \code{"C"}), \code{"viridis"} (or \code{"D"}, the default option) and -\code{"cividis"} (or \code{"E"}).} - -\item{values}{If colours should not be evenly positioned along the gradient -this vector gives the position (between 0 and 1) for each colour in the -colours vector. See rescale() in the scales package for a convience function -to map an arbitrary range to between 0 and 1.} - -\item{space}{Colour space in which to calculate gradient. Must be "Lab" - -other values are deprecated.} - -\item{na.value}{Missing values will be replaced with this value.} - -\item{guide}{A function used to create a guide or its name. See \code{\link[=guides]{guides()}} -for more info.} - -\item{aesthetics}{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 colour and fill aesthetics at -the same time, via \code{aesthetics = c("colour", "fill")}.} - -\item{type}{One of "gradient" or "viridis" indicating the colour scale to -use. Can be changed with \code{\link[=options]{options()}}, and the chart package set it to -\code{"viridis"} in case it is not set yet when the package is attached.} -} -\description{ -ggplot2 version 3 add these function to include viridis color scales. These -functions are cloned from ggplot2 v.3.0.0 in order to use the same color -scheme with earlier versions of ggplot2. Note, however, that the options -\code{ggplot2.continuous.fill} and \code{gplot2.continuous.colour} are set to -\code{"viridis"} if not already specified. This changes the default for continuous -colors in favor of viridis for both \code{ggplot()} and \code{chart()}. -} -\examples{ -geyser <- data.io::read("geyser", package = "MASS") -chart(data = geyser, waiting ~ duration) + - xlim(0.5, 6) + ylim(40, 110) + - stat_density2d(aes(fill = ..level..), geom = "polygon") + - theme(panel.grid = element_blank()) -> gg - -combine_charts( - list( - gg + scale_fill_viridis_c(option = "A") + labs(x = "A = magma", y = NULL), - gg + scale_fill_viridis_c(option = "B") + labs(x = "B = inferno", y = NULL), - gg + scale_fill_viridis_c(option = "C") + labs(x = "C = plasma", y = NULL), - gg + scale_fill_viridis_c(option = "D") + labs(x = "D = viridis", y = NULL), - gg + scale_fill_viridis_c(option = "E") + labs(x = "E = cividis", y = NULL) - ), ncol = 3, nrow = 2 -) -} -\seealso{ -\code{\link[=chart]{chart()}}, \code{\link[=chart_theme]{chart_theme()}} -} -\concept{Viridis colors} -\keyword{color}