The last sections have shown that there is an abundance of options for colors in R. Fortunately, we rarely need all those options at the same time.
This chapter provided a colorful primer on the following topics:
- distinguishing between colors and color palettes;
- distinguishing different kinds of color palettes;
- knowing various ways of specifying colors (by name, HEX code, or RGB values);
- knowing corresponding ways of creating new color palettes;
- knowing how to create or choose color palettes for people with color-vision impairments;
- knowing many packages that provide colors and functions for dealing with color.
Given the recent integration of powerful HCL palettes in the grDevices component of R (see
hcl.colors() function from R 3.6.0 onwards), we rarely need anything else. In fact, most people can happily live a colorful life as R users without ever needing to load a dedicated color package.
Nevertheless, having additional color options can still make this life easier or more enjoyable. For instance, we can recruit other packages for particular functions that deal with color information (e.g., using the
seecol() functions from unikn to modify and view color palettes) or catering to more personal or exotic color preferences (e.g., using the special palettes provided by the colourlovers, rijkspalette, unikn, wesanderson, or yarrr packages).
After discussing a plethora of options for dazzling colors, we conclude this chapter on a cautionary note: Colors can be perceived as pretty or as ugly, but choosing them wisely is not just a matter of taste, but also one of physics, biology, psychology, history, and individual and societal context. Whenever considering which color to add to a graph, we should first ask ourselves whether a particular choice of colors is suited to convey the meaning of a visual representation more transparently. Thus, when choosing and using color, always aim for both clarity and beauty.