Cheat Sheets for Plotting Symbols and Color Palettes

R Core Team
(R-core@R-project.org
) The R Project for Statistical Computing.

Yihui Xie
(xie@yihui.name / GitHub
/ Twitter) Department of Statistics, Iowa State University; interested in statistical computing and graphics; author of knitr, animation and a few other R packages.

Lijia Yu
(yu@lijiayu.net / GitHub
/ Twitter) A master candidate majoring in Bioinformatics at Beijing Institute of Genomics.

This cheat sheet shows a few commonly used plotting symbols and color palettes in R. Now you do not
need to memorize the facts like “19 is the big solid dot and 21 is an open circle that can have a
different background color” – just bookmark this cheat sheet. In fact it was motivated by Dr
Rafael Irizarry, who printed the color palettes on a piece of paper
and pinned that to the wall in his office.

Plotting symbols (pch)

There are many plotting symbols in the graphics package. We can set the pch parameter to set
the symbols. See ?points for more information.

Below is a figure containing the plot symbols from pch = 0 to 25 along with some
character-based plot symbols. We can use, for example, plot(x, y, pch = 3) for plus signs (+)
in a scatterplot.

Below are the color palettes in RColorBrewer (if you do not want to use ggplot2, you should
consider using this package to generate colors for your plots; just do not use the meaningless
rainbow() palette):

In R, the function colors() returns a vector of 657 color names. When you really
need to specify the color by its name, you are recommended to check out this nice color
chart created by Earl F.
Glynn.