You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jzadra, ran across this question while looking for an option to produce more than 8 colors. In my case, I ended up putting together this hacky fix for creating a lengthier palette based on the colorblindr defaults. Once the palette is generated, then it can be inserted into ggplot with scale_fill_manual(values = colorblindr_cont).
When my monitor is set to grayscale it seems to generally maintain the desired colorblindr differentiation. Maybe this will work for your needs or be easily adjusted if not?
library(RColorBrewer)
gen_palette <- function(data, var){
n_colors <- length(unique(data[, var])) # number of unique values for var
color_pal <- c(
"#E69F00", "#56B4E9", "#009E73", "#F0E442",
"#0072B2", "#D55E00", "#CC79A7", "#000000"
)
custom_colors <- colorRampPalette(color_pal)(n_colors)
return(custom_colors)
}
colorblinr_cont <- gen_palette(data = dataset, var = "varname")
I juist wanted to confirm that this package doesn't support continuous scales? I'm not missing anything?
The text was updated successfully, but these errors were encountered: