In this section, you are going to learn how to use ggplot2
and ggmap
to visualize spatial data. The section is structured as follows. First, we will review the ggplot2
framework using a simple example of a time series plot since (as you will see right away) the syntax is quite different from that of other plotting methods we used until now. After that, we will practice a little bit more with producing ordinary, nonspatial plots. Next, we will see how the ggplot2
plots can be saved for subsequent use, both within the R environment and in external files. Finally, the last two sections will deal with the most important material from this book's perspective. In these two sections, we will see how spatial data can be incorporated into ggplot2
visualizations to produce maps, and how we can conveniently download reference background images for such maps using ggmap
.
Before going into the details of ggplot2
, it is important to state that to use this package, our input...