Press "Enter" to skip to content

Plotting Diagrams In R With nest() And map()

Sebastian Sauer shows how to display multiple ggplot2 diagrams together using facets as well as a combination of the nest() and map() functions:

One simple way is to plot several facets according to the grouping variable:

d %>% ggplot() + aes(x = hp, y = mpg) + geom_point() + facet_wrap(~ cyl)

Faceting is great, but it’s good to know the other technique as well.