Line plots
A line graph displays a functional relationship between two continuous variables. A map displays spatial data. The two may seem different, but they are made in similar ways. This tutorial will examine them both.
In this tutorial, you’ll learn how to:
- Make new types of line plots with
geom_step()
,geom_area()
,geom_path()
, andgeom_polygon()
- Avoid “whipsawing” with the group aesthetic
- Find and plot map data with
geom_sf()
- Transform a coordinate system into a map projection with
coord_sf()
The tutorial is adapted from R for Data Science by Hadley Wickham and Garrett Grolemund, published by O’Reilly Media, Inc., 2016, ISBN: 9781491910399. You can purchase the book at shop.oreilly.com.
The tutorial uses the {ggplot2}, {sf}, and {dplyr} packages, which have been pre-loaded for your convenience.