Book Image

ggplot2 Essentials

By : Donato Teutonico
Book Image

ggplot2 Essentials

By: Donato Teutonico

Overview of this book

Table of Contents (14 chapters)
ggplot2 Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Plotting maps with ggplot2 and ggmap


In ggplot2, it is possible to include maps as well as map data within a plot. This can be done thanks to certain ggplot2 functions that allow the combination of typical ggplot2 elements with data from the maps package. Alternatively, ggmap, a dedicated R package, was developed by David Kahle and Hadley Wickham and enables the easy inclusion of map data in ggplot2 graphs using map data provided on the Internet.

Mapping representations with ggplot2 and maps

The maps package is an R package that contains cartographic data for some individual countries as well as for the entire world, including example datasets that can be used to combine data to map representations. The limitation of this data is related to the limited maps available, consequently limiting the plots that can be realized with this approach. In addition to this, you should also keep in mind that these maps may be quite outdated. The maps currently available in the package are as follows:

  • world...