ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Communicating with Data in the Tidyverse

Ver curso

Instrucciones del ejercicio

  • 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.
  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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")
  )
Editar y ejecutar código