修改背景颜色并添加页边距
通过为 theme 函数调用添加更多参数,进一步自定义图形外观。
您可以继续使用上一个练习中创建的 ilo_plot 对象。
本练习是课程的一部分
在 Tidyverse 中用数据进行沟通
练习说明
- 将图形的整体背景颜色更改为
"gray95"。- 这次需要使用与
element_text不同的函数——用于矩形绘图元素的那个。请回看视频确认是哪一个。
- 这次需要使用与
- 为图形添加页边距:上下各 5mm,左右各 10mm。
- 页边距需要按以下顺序指定:上、右、下、左。
交互式实操练习
通过完成这段示例代码来试试这个练习。
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")
)