Faceting and Saving Plots

Learn to create matrices of related plots using facets and export plots using ggsave.

As data scientists, we often need to look at many plots at once and share those plots with others. Combinations of related plots are essential for understanding and communicating insights from data. The ggplot2 package provides two convenient features to help support this need. The first is faceting, which allows us to create a set of plots displayed as a matrix, each showing a subset of the data. The second is ggsave, which enables us to export our plots to several different file formats for use outside of R. In this lesson, we’ll explore facets, how to use them to create a matrix of plots, and how to save plots in different formats for various purposes.

Get hands-on with 1200+ tech skills courses.