D Using colors
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 chapter provides a primer on finding, choosing, and using colors in R. This knowledge complements the chapter on Visualizing data (see Chapter 2), but is also useful in itself. We will use the unikn package (Neth & Gradwohl, 2019) to illustrate some points, but also mention many other packages that provide great color support in R.
Neth, H., & Gradwohl, N. (2019). unikn: Graphical elements of the University of Konstanz’s corporate design. Retrieved from https://CRAN.R-project.org/package=unikn