A.4 – Visualization

16 - 17 May, 2016

Contents

1 Colors

Colors should reflect the nature of the data and be carefully chosen to convey equivalent information to all viewers. The RColorBrewer package provides an easy way to choose colors; see also the colorbrewer2 web site.

library(RColorBrewer)
display.brewer.all()

We’ll use a color scheme from the ‘qualitative’ series, to represent different levels of factors and for choice of colors. We’ll get the first four colors.

3ggplot2 Graphics

3.1 Basics

Tell ggplot2 what to plot using ggplot() and aes(); we’ll use the columns hp (horsepower) and mpg (miles per gallon).

ggplot(mtcars, aes(x=hp, y=mpg))

Note the neutral gray background with white gridlines to provide unobtrusive orientation. Note the relatively small size of the axis and tick labels, to avoid distracting from the pattern provided by the data.