Using a Theme to Customize a Plot

In this example, we'll use thematic commands to customize and improve a plot's appearance. Let's begin by implementing the following steps:

  1. Let's use the HollywoodMovies data and create a bar chart of movie titles and their world gross amounts. Since we have too many objects, we will make a subset, as follows:
dfn <- subset (HollywoodMovies, Genre %in%c("Action","Adventure","Comedy","Drama","Romance") & LeadStudio %in%c("Fox","Sony","Columbia","Paramount","Disney")).
  1. Let's predefine a theme. Type ?theme (alternatively, when you type theme, R shows you the options available; see the screenshots that follow). Some of the available options are as follows:
  1. Note that axis.title is of the type element_text ...

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.