Introduction

Color blindness is color vision deficiency, which means people with color blindness may be not aware of differences among colors that are obvious to the people without it. This package is designed to provide a collection of safe colors for plots such as heatmaps, pie chart, and try to find a solution for acceptable figures for all the end users.

Safe colorsets

There are lots of packages already collected lots of safe colors. I list some of them, but not limited here.

For this package, I will try to collect as much as possible safe color sets ready to use.

Color vision deficiency (CVD) simulator

The tool used to simulate the color vision deficiency is called CVD simulator. I list some of packages here with CVD simulator.

  • Hans Brettel 1997(Brettel et al., 1997)

  • Francoise Vienot 1999(Viénot et al., 1999) (implemented in this package and package dichromat )

  • Gustavo M. Machado 2009(Machado et al., 2009) (implemented in package colorspace)

  • Claire D. McWhite and Claus O. Wilke. colorblindr

How to use this package

Use safe color to plot

To plot figures by colors of this package, there are three steps:

  1. select correct safe color set.

  2. plot with the color set.

  3. check the plot by CVD simulator.

For example if we want to plot a heatmap.

library(colorBlindness)
mat <- matrix(1:81, nrow = 9, ncol = 9)

library(ggplot2)
library(reshape2)
mat1 <- melt(t(mat[9:1, ]))
len <- length(Blue2DarkRed12Steps)-1
mat1$v2 <- cut(mat1$value,
              breaks = seq(0,ceiling(81/len)*len, 
                           length.out = len+1))
ht <- ggplot(mat1) + 
  geom_tile(aes(x=Var1, y=Var2, fill=v2)) + 
  scale_fill_manual(values=Blue2DarkRed12Steps) + 
  theme_bw()
# check the plot by CVD simulator
cvdPlot(ht)