Color is essential in many charts and maps. There are a lot of color
palettes to choose from: most visualization software tools have their
own palettes and there are many other series of color palettes, such as
ColorBrewer (Harrower and Brewer, 2003). To make life easier for R
users, there are a couple of packages that contain a large collection of
palettes, most notably pals
(Wright, 2021) with 139 and
paletteer
(Hvitfeldt, 2021) with 2569 (!) palettes.
However, people often cannot see the trees through the forest, so
therefore they tend to stick with the color palettes they know, or with
the most popular ones.
The cols4all
package also contains a large collection of
palettes (to be precise 464 at the time of writing), but with the
central question: which palettes are good and why?
There is no simple answer, since there are many aspects to take into
account, which may have opposite effects. In cols4all
we
examine the following aspects:
Color Blind Friendliness First and most importantly, is a palette suitable for colorblind people? About 1 out of 12 humans have a color vision deficiency, and we want to include them; hence the package name “colors for all”.
HCL Analysis Does a palette work well for statistical purposes? We analyse this with the HCL (hue-chroma-luminance) color space. Concrete questions for these analysis are the following. How vivid are colors? Do the colors stand out about equally (which we call fairness)? What hue ranges are used for quantitative color palettes?
Nameability (in development) Easy to name colors are also easy to remember. Therefore, it is beneficial to use a color palette with easy nameable colors.
Contrast What is the contrast between the colors in the palette? We focus on two specific questions: 1) Is there sufficient contrast with the background color (usually white or black)? This is especially needed for text but also point- and line charts. 2) Are border lines needed to separate colors?
3D Blues Does the palette contain blue colors that could result in a floating effect?
Currently, cols4all contains palettes from several popular and lesser known color palette series: “brewer”, “c4a”, “carto”, “hcl”, “kovesi”, “met”, “miscs”, “parks”, “poly”, “scico”, “seaborn”, “stevens”, “tableau”, “tol”, “viridis” , and “wes”. Stand-alone palettes that are included have been put in the series “misc” (miscellaneous). Own palettes series can be added as well.
Color palettes are organized and made consistent with each other. For instance, all sequential palettes go from light to dark. Furthermore, for each color palette a color for missing values is assigned, which is especially important for spatial data visualization. Currently we support several types: categorical (qualitative) palettes, sequential palettes, diverging palettes, and bivariate palettes (divided into four subtypes).