Encoding Groups

Use easily distinguishable colors to encode groups

See: categorical variables (see Figure fig-Cata-Encoding)

In contrast to continuous variables, categorical variables1 lend themselves well to color representation. For nominal (i.e. unordered) variables, qualitative colors are appropriate, whereas ordinal data can be better represented with sequential colors (see Figure fig-Cata-Encoding). Adobe Illustrator, as well as R, come with pre-selected color palettes. When you have to choose colors manually, consult the guidelines for color schemes below.

  • 1 To avoid confusion, it’s useful to know that different text books and even different packages within a software program, such as R, will refer to categorical variables under different names. I use the generic categorical, which I feel makes a nice distinction to continuous. Discrete, qualitative (as opposed to quantitative), and factor variables are also used in specific contexts. For our purposes they are all the same thing in different guises.