The simplest versions of plots use color rather sparingly. For instance, consider this simple bar chart:
Not exactly the most colorful thing you’ve ever seen eh?
R provides standard color palettes comprised of vectors containing a series of contiguous colors.
It is simple to view color wheels based upon default color palettes using pie charts.
Determine how many different colors you need and set a variable to this number. Then create a pie chart to see what the shape of our color wheel will be.
Now try some of the built in palettes and evaluate the results.
If you would prefer something skewed to the reds and yellows, use heat.
If you prefer something in earth tones, use terrain.
If you prefer these this type of palette, but with a bit more blue, try topo.
Finally, if you prefer subdued pinks and blues, try cm.
So returning to our original bland example we instead specify a color palette.
These are a few quick examples that demonstrate how to quickly to add color in a reasonably aesthetically pleasing way. To get more information on palettes in R:
This really only scratches the surface on the use of color in R. There are many different considerations on the use of color that are dependent on the device or medium involved, person viewing the image, the type of visualization etc. The best single presentation I have seen on the use of color in R is by Earl F. Glynn at the Stowers Institute for Medical Research. His presentation is available in pdf. He goes into much more depth about how color is represented and manipulated in R. He discusses what objects can be colored, referencing colors by name, gradients, color blindness, and differences in color presentation in different devices. To get an idea of some of the ways color is referenced that are explained in the presentation enter the following help command.
In case you think all this color stuff should be left to the artists and designers, he provides a link to an article at IBM that argues effectively to the contrary.
If you want even more information about how the eye perceives color and how color effectively encode information in visualizations, Hanspeter Pfister at Harvard teaches a course on the subject. Videos of the 2008 version of the course are available on iTunes.