ABSTRACT

Three main data plotting systems are available to R users: base R, package ‘lattice’ and package ‘ggplot2’, the last one being the most recent and currently most popular system available in R for plotting data. In this chapter you will learn the concepts of the grammar of graphics, on which package ‘ggplot2’ is based. You will also learn how to build several types of the data plots with package ‘ggplot2’. Because of the popularity and flexibility of ‘ggplot2’, many contributed packages extending its functionality have been developed. The focus here is mainly on the grammar itself as defined in package ‘ggplot2’ and some extensions to this grammar provided by contributed packages including ‘ggpp’ and ‘ggpmisc’, developed by the author.