Using More Layers to Customize a Histogram

In this section, we'll use layers to customize a histogram.

Let's begin by implementing the following steps:

  1. Plot the two preceding histograms.
  2. Change the x-axis title: Add another layer to change the x-axis title (remove the _ in the variable name), and save it in a plot (p4).
  3. Try plotting them individually (as p1, p2, p3, and p4) on the command line.

The outcome will be four plots, and the final plot should look as follows:

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.