Introduction to ggplot2
In Part 3 of this book, beginning now, the subject is data visualization. For the next three chapters, we will learn about ggplot2, enhanced visualizations such as interactive plots, maps, and 3D graphics, as well as how to plot graphics in Microsoft Power BI using R code.
In this chapter, more specifically, we will concentrate on learning the basics of ggplot2
, a core library from the tidyverse package, to build powerful and highly customizable visualizations. The library was created by Hadley Wickham in 2015 and has evolved a lot since then, with 18 new releases. It is built on the premises of the grammar of graphics, a concept that states that a graphic must be created in layers, also called grammatical elements for this purpose.
In summary, this chapter will outline the following:
- The grammar of graphics
- The basic syntax of ggplot2
- Plot types