Created
July 8, 2022 14:25
-
-
Save Shusei-E/8ac19ed745fd3279875a458970500698 to your computer and use it in GitHub Desktop.
color code
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
color_brewer <- function(ids = NULL, rev = TRUE) { | |
# RColorBrewer::brewer.pal(n = 7, name = "Set1") | |
colour <- c( | |
"#377EB8", | |
"#E41A1C", | |
"#4DAF4A", | |
"#F7D94C", | |
"#984EA3", | |
"#A65628", | |
"#FF7F00", | |
"#F781BF", | |
"#999999", | |
"#4D4D4D", | |
"#E5C494", | |
"#1B813E", | |
"#90B44B" | |
) | |
if (is.null(ids)) { | |
if (rev) { | |
return(rev(colour)) | |
} else { | |
return(colour) | |
} | |
} else { | |
return(colour[ids]) | |
} | |
} | |
color_gdocs <- function(n = NULL) { | |
# https://yutannihilation.github.io/allYourFigureAreBelongToUs/ggthemes/gdocs_pal/ | |
colors <- c( | |
"#3366CC", | |
"#FF9900", | |
"#109618", | |
"#DC3912", | |
"#990099", | |
"#0099C6", | |
"#DD4477", | |
"#66AA00", | |
"#B82E2E", | |
"#316395", | |
"#994499", | |
"#22AA99", | |
"#AAAA11", | |
"#6633CC", | |
"#8B0707", | |
"#E67300", | |
"#651067", | |
"#329262", | |
"#5574A6", | |
"#3B3EAC" | |
) | |
if (is.null(n)) { | |
return(colors) | |
} else { | |
return(colors[1:n]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment