LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Communicating with Data in the Tidyverse

Kurs anzeigen

Anleitung zur Übung

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

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

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")
  )
Code bearbeiten und ausführen