ABSTRACT

R is rich in graphical functions and it is very easy to produce high- quality graphics. Base R plotting uses an ink-on-paper approach where high-level graphics functions (e.g., plot, hist, and boxplot) initialize a plot or create an entire plot while low-level graphics functions (e.g., lines, title, and legend) add to the current plot. The ink-on-paper approach means that once something is added to the plot it cannot be removed, and any desired customizations to the plot must be included in the call(s) to the graphics function(s) that produce the plot. The base R graphics have been extended with several packages which extend or redefine graphics, most notably the lattice package which produces trellis graphics, and ggplot2 which produces graphics using graphical grammar. Both packages are highly useful and well worth learning, but they are beyond the scope of this book. Interested readers are referred to the excellent books by Sarkar (2008) and Wickham (2009).