We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
Functions:
#' Provide Colorblind Compliant Colors #' #' 8 Hex RGB color defintions suitable for charts for colorblind people. #' #' @export color_blind <- function(){ c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") } # Fill ts_scale_fill_colorblind = function(.ColorList = 2L:8L, ...){ ggplot2::scale_fill_discrete(..., type = color_blind()) } # Color ts_scale_color_colorblind = function(.ColorList = 2L:8L, ...){ ggplot2::scale_color_discrete(..., type = color_blind()) }
Example:
library(tidyverse) ggplot( diamonds, aes(clarity, fill = cut) ) + geom_bar(position = "dodge") + ts_scale_fill_colorblind()
Sorry, something went wrong.
https://stackoverflow.com/questions/19300134/ggplot2-with-colour-blind-ggthemes-except-black
Final functions
#' Provide Colorblind Compliant Colors #' #' 8 Hex RGB color definitions suitable for charts for colorblind people. #' #' @export color_blind <- function(){ c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") } #' Provide Colorblind Compliant Colors #' @export td_scale_fill_colorblind <- function(..., theme = "td") { pal <- switch(theme, "td" = unname(color_blind()) %>% rep(100) ) ggplot2::scale_fill_manual(values = pal) } #' Provide Colorblind Compliant Colors #' @export td_scale_color_colorblind = function(..., theme = "td") { pal <- switch(theme, "td" = unname(color_blind()) %>% rep(100) ) ggplot2::scale_color_manual(values = pal) }
6327885
Merge pull request #182 from spsanderson/development
ec1af66
Fixes #181
spsanderson
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: