Setting themes
Reusing a theme across many plots helps to provide a consistent style. You have several options for this.
- Assign the theme to a variable, and add it to each plot.
- Set your theme as the default using
theme_set().
A good strategy that you'll use here is to begin with a built-in theme then modify it.
plt_prop_unemployed_over_time is available. The theme you made earlier is shown in the sample code.
Deze oefening maakt deel uit van de cursus
Introduction to Data Visualization with ggplot2
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Save the theme as theme_recession
___ <- theme(
rect = element_rect(fill = "grey92"),
legend.key = element_rect(color = NA),
axis.ticks = element_blank(),
panel.grid = element_blank(),
panel.grid.major.y = element_line(color = "white", size = 0.5, linetype = "dotted"),
axis.text = element_text(color = "grey25"),
plot.title = element_text(face = "italic", size = 16),
legend.position = c(0.6, 0.1)
)
# Combine the Tufte theme with theme_recession
theme_tufte_recession <- ___
# Add the Tufte recession theme to the plot
___