Alter background color and add margins
Further customize the look of your plot with more arguments to the theme
function call.
You can continue working on your ilo_plot
object created in the last exercise.
This exercise is part of the course
Communicating with Data in the Tidyverse
Exercise instructions
- Change the overall background color of your plot to
"gray95"
.- This time, another function than
element_text
is needed – one for rectangular plot elements. Rewatch the video to know which.
- This time, another function than
- Add margins to the plot: 5mm top and bottom, 10mm to the left and the right.
- The margins need to be specified in the following order: top, right, bottom, and left.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
ilo_plot +
# "theme" calls can be stacked upon each other, so this is already the third call of "theme"
theme(
plot.background = ___(fill = ___),
plot.margin = unit(c(___, ___, ___, ___), units = "mm")
)