D Using colors

ds4psy datasets

Using colors is one of the most powerful ways to structure information. Whereas understanding the concept of color is an ambitous endeavor — involving various arts, humanities, and sciences — using colors effectively requires knowledge, creativity, and experience (e.g., in choosing or creating appropriate color scales).

While this is easily the most colorful chapter of this book, defining and selecting colors in R can seem rather dull or technical. Thanks to its integrated graphics and grDevices packages, any installation of R comes fully-loaded with colors and tools for manipulating them. This means that most users of R do not need to understand the details of color theory to create beautiful visualizations. However, to efficiently find, choose, and combine colors, we need to know where to look and in which ways colors are represented in R.

This appendix provides a primer on finding, choosing, and using colors in R. A deeper knowledge about the range of color options in R directly complements the chapter on Visualizing data (see Chapter 2), but is also useful in itself. We will use some options and functions of the unikn package (Neth & Gradwohl, 2020) for illustrative purposes, but also mention additional packages that provide great color support in R.

References

Neth, H., & Gradwohl, N. (2020). unikn: Graphical elements of the University of Konstanz’s corporate design. Retrieved from https://CRAN.R-project.org/package=unikn