Skip to content

Instantly share code, notes, and snippets.

@benjamin-chan
Last active January 18, 2024 04:30
Show Gist options
  • Save benjamin-chan/765d925783868cc68260ce296795fd97 to your computer and use it in GitHub Desktop.
Save benjamin-chan/765d925783868cc68260ce296795fd97 to your computer and use it in GitHub Desktop.
HPA color palette for R
pal <- c("#005595", # Medium Electric Blue
"#5E7F24", # Sap Green
"#D87E1A", # Ochre
"#007FAD", # Celadon Blue
"#A01C3F", # Deep Carmine
"#F2F2F2", # Anti-Flash White
"#949494", # Spanish Gray
"#606060", # Granite Gray
# Sequential Blue
"#6799BF", "#4779B1", "#005595", "#00406F", "#002B4A",
# Sequential Gray
"#949494", "#6F6F6F", "#494949", "#303030", "#171717",
# Sequential Green
"#78A12F", "#5E7E24", "#455F1B", "#314113", "#1E280B",
# Sequential Orange
"#D87E1A", "#AD6314", "#8B5111", "#663C0C", "#3E2608",
# Sequential Teal
"#009DD6", "#007FAD", "#005C80", "#003E55", "#002532",
# Sequential Magenta
"#E2587E", "#A01C3F", "#771530", "#500E1F", "#310913")
# Color names from https://www.color-name.com
# EXAMPLE
# devtools::source_gist("https://gist.github.com/benjamin-chan/765d925783868cc68260ce296795fd97")
# pal
# library(ggplot2)
# palette <- c("Discrete",
# "Sequential Blue",
# "Sequential Gray",
# "Sequential Green",
# "Sequential Orange",
# "Sequential Teal",
# "Sequential Magenta")
# df <- expand.grid(palette = palette, seq = LETTERS[1:5], id = seq(1, 50))
# df <- cbind(df, x = rnorm(nrow(df)), y = rnorm(nrow(df)))
# df$color <- factor((unclass(df$palette) - 1) * nlevels(df$seq) + unclass(df$seq))
# ggplot(df) +
# geom_density(aes(x = x, color = color, fill = color)) +
# scale_color_manual(values = c(pal[1:5], pal[9:38])) +
# scale_fill_manual(values = c(pal[1:5], pal[9:38])) +
# facet_grid(palette ~ seq) +
# theme_void() + theme(legend.position = "none", strip.text.y = element_text(hjust = 0))
# SOURCE
# https://dhsoha.sharepoint.com/:b:/r/teams/Hub-OHA-HPA/Shared%20Documents/Comms%20Resources/HPA-Data-Viz-Guide.pdf
@benjamin-chan
Copy link
Author

HPA_palette

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment