So, where does ggplot get its colors? If you’ve ever asked ggplot to color on the basis of a factor, you might have beeen surprised by the default color choices. The fact is, ggplot colors factors on the basis of finding evenly spaced colors around the
HSL color circle, shown below: EDIT: ggplot2 actually uses HCL space, which is not the same as the color circle below, but the basic idea of equally-spaced colors is valid.
So, for one color, the default is a salmon/pink color; two colors sees the addition of blue, which is found 180 degrees from the first color. For three colors, the spacing must remain even so each color is now only 120 degrees from one another, and so on. Here’s a plot that shows the color palette ggplot automatically chooses for between 1 and 8 factor levels; enjoy!
This is the output: