diff --git a/R/scales.R b/R/scales.R index 9444a5e9..a357c4ed 100644 --- a/R/scales.R +++ b/R/scales.R @@ -24,6 +24,29 @@ #' @param ... Further arguments of [ggplot2::discrete_scale()] or #' [ggplot2::continuous_scale()]. #' +#' @examples +#' library(ggplot2) +#' +#' set.seed(596) +#' txsamp <- subset( +#' txhousing, +#' city %in% c( +#' "Houston", "Fort Worth", +#' "San Antonio", "Dallas", "Austin" +#' ) +#' ) +#' +#' ggplot(txsamp, aes(x = sales, y = median)) + +#' geom_point(aes(colour = city)) + +#' scale_color_bde_d() + +#' theme_minimal() +#' +#' +#' ggplot(txsamp, aes(x = sales, y = median)) + +#' geom_point(aes(colour = city)) + +#' scale_color_bde_d("bde_rose_pal") + +#' theme_minimal() +#' scale_color_bde_d <- function(palette = c("bde_vivid_pal", "bde_rose_pal"), ...) { # nocov start diff --git a/codemeta.json b/codemeta.json index 39fe7539..1bb2b631 100644 --- a/codemeta.json +++ b/codemeta.json @@ -180,7 +180,7 @@ }, "applicationCategory": "Macroeconomics", "isPartOf": "https://ropenspain.es/", - "fileSize": "507.164KB", + "fileSize": "508.079KB", "citation": [ { "@type": "SoftwareSourceCode", diff --git a/man/scales_bde.Rd b/man/scales_bde.Rd index dc17a8ff..1963132f 100644 --- a/man/scales_bde.Rd +++ b/man/scales_bde.Rd @@ -29,6 +29,30 @@ A \code{ggplot2} color scale. \description{ Scales to be used with the \CRANpkg{ggplot2} package. Discrete palettes are named as \verb{scale_*_bde_d} while continuous palettes are named \verb{scale_*_bde_c}. +} +\examples{ +library(ggplot2) + +set.seed(596) +txsamp <- subset( + txhousing, + city \%in\% c( + "Houston", "Fort Worth", + "San Antonio", "Dallas", "Austin" + ) +) + +ggplot(txsamp, aes(x = sales, y = median)) + + geom_point(aes(colour = city)) + + scale_color_bde_d() + + theme_minimal() + + +ggplot(txsamp, aes(x = sales, y = median)) + + geom_point(aes(colour = city)) + + scale_color_bde_d("bde_rose_pal") + + theme_minimal() + } \seealso{ \code{\link[=bde_vivid_pal]{bde_vivid_pal()}}, \code{\link[ggplot2:discrete_scale]{ggplot2::discrete_scale()}},