Map plots
We live in the information era. Enormous amounts of data are created each day, from all parts of the world. Part of that data has location information attached to it (latitude and longitude), enabling the data scientists that have access to it to create visualizations using maps. Anaysis of store sales by city, state taxes collection, tourism destinations, and internet access by country are only a few examples of a large spectrum of possibilities. That is enough reason to learn how to use ggplot2 to create plots using maps.
A side note before we jump into the action is that map plots are a vast domain as well, being part of the spatial data analysis domain, which is out of the scope of this book. Here, the intention is to show the capabilities of ggplot2. To learn in more depth about map plotting, there is some material available in the Further reading section.
To plot a map, the geometry used is geom_map()
. But before we can plot anything, ggplot2 requires us to load...