Last active
August 19, 2024 22:17
-
-
Save benjamin-chan/765d925783868cc68260ce296795fd97 to your computer and use it in GitHub Desktop.
HPA color palette for R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pal <- c("#064276", # OHA Blue | |
"#EC5A24", # OHA Orange | |
"#009F98", # Sea Glass | |
"#752E71", # Beauty Berry | |
"#FCB53B", # Oregon Sunshine | |
"#D6DBE9", # OHA Blue (background tint) | |
"#E6F0EF", # Sea Glass (background tint) | |
"#E9E1E8", # Beauty Berry (background tint) | |
"#FFF1DC", # Oregon Sunshine (background tint) | |
"#BC4010", # OHA Orange (dark) | |
"#007771", # Sea Glass (dark) | |
"#F2F2F2", # Light gray; requires the use of a border | |
"#949494", # Medium gray (updated) | |
"#606060") # Dark gray; default for text | |
# EXAMPLE | |
# devtools::source_gist("https://gist.github.com/benjamin-chan/765d925783868cc68260ce296795fd97") | |
# pal | |
# palette <- c("Discrete", "Background", "Dark", "Gray") | |
# 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)) | |
# library(ggplot2) | |
# ggplot(df) + | |
# geom_density(aes(x = x, color = color, fill = color)) + | |
# scale_color_manual(values = c(pal[1:5], pal[1], "white", pal[3:5], "white", pal[10:11], "white", "white", "black", pal[13:14], "white", "white")) + | |
# scale_fill_manual(values = c(pal[1:5], pal[6], "white", pal[7:9], "white", pal[10:11], "white", "white", pal[12:14], "white", "white")) + | |
# facet_grid(palette ~ seq, switch = "y") + | |
# theme_void() + | |
# theme(legend.position = "none", | |
# strip.text.x = element_blank(), | |
# strip.text.y = element_text(hjust = 1)) | |
# SOURCES | |
# https://dhsoha.sharepoint.com/:b:/r/teams/Hub-OHA-HPA/Shared%20Documents/Comms%20Resources/HPA-Data-Viz-Guide.pdf | |
# https://sharedsystems.dhsoha.state.or.us/DHSForms/Served/le2022.pdf |
Author
benjamin-chan
commented
Aug 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment