gmupal<-c("#006633", "#FFCC33",
"#3EC2CF", "#007DC5",
"#6b469c", "#BCD631",
"#A62380", "#F37021")
pal_gmu <- function(palette = c("gmupal"), alpha = 1) {
palette <- match.arg(palette)
if (alpha > 1L | alpha <= 0L) stop("alpha must be in (0, 1]")
raw_cols <- gmupal
raw_cols_rgb <- col2rgb(raw_cols)
alpha_cols <- rgb(
raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ],
alpha = alpha * 255L, names = names(raw_cols),
maxColorValue = 255L
)
scales::manual_pal(unname(alpha_cols))
}
scale_color_gmu <- function(palette = c("gmupal"), alpha = 1, ...) {
palette <- match.arg(palette)
ggplot2::discrete_scale("colour", "gmupal", pal_gmu(palette, alpha), ...)
}
scale_fill_gmu <- function(palette = c("gmupal"), alpha = 1, ...) {
palette <- match.arg(palette)
ggplot2::discrete_scale("fill", "gmupal", pal_gmu(palette, alpha), ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.