From 0ca064a2edc61db1a289b6a280c9ae04273280fa Mon Sep 17 00:00:00 2001 From: Vinay Siddhartha Swamy Date: Thu, 15 Oct 2020 12:51:56 -0400 Subject: [PATCH] added to scale-hue.r documentation to explain behavior when using named color vectors --- R/scale-hue.r | 4 +++- man/scale_colour_discrete.Rd | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/scale-hue.r b/R/scale-hue.r index 9b93f297c7..eea068d474 100644 --- a/R/scale-hue.r +++ b/R/scale-hue.r @@ -76,7 +76,9 @@ scale_fill_hue <- function(..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0 #' * A character vector of color codes. The codes are used for a 'manual' color #' scale as long as the number of codes exceeds the number of data levels #' (if there are more levels than codes, [scale_colour_hue()]/[scale_fill_hue()] -#' are used to construct the default scale). +#' are used to construct the default scale). If this is a named vector, then the color values +#' will be matched to levels based on the names of the vectors. Data values that +#' don't match will be set as `na.value`. #' * A list of character vectors of color codes. The minimum length vector that exceeds the #' number of data levels is chosen for the color scaling. This is useful if you #' want to change the color palette based on the number of levels. diff --git a/man/scale_colour_discrete.Rd b/man/scale_colour_discrete.Rd index abcc712239..c50c42400d 100644 --- a/man/scale_colour_discrete.Rd +++ b/man/scale_colour_discrete.Rd @@ -23,7 +23,9 @@ scale_fill_discrete( \item A character vector of color codes. The codes are used for a 'manual' color scale as long as the number of codes exceeds the number of data levels (if there are more levels than codes, \code{\link[=scale_colour_hue]{scale_colour_hue()}}/\code{\link[=scale_fill_hue]{scale_fill_hue()}} -are used to construct the default scale). +are used to construct the default scale). If this is a named vector, then the color values +will be matched to levels based on the names of the vectors. Data values that +don't match will be set as \code{na.value}. \item A list of character vectors of color codes. The minimum length vector that exceeds the number of data levels is chosen for the color scaling. This is useful if you want to change the color palette based on the number of levels.