調整標題的外觀
除了套用已定義的 theme 預設外,你也可以透過修改各種樣式屬性,進一步微調你的圖表。提示:你可以重複使用並覆寫上一個練習產生的 ilo_plot 變數——目前的圖已經顯示在右側視窗中。
本練習屬於課程
在 Tidyverse 中以資料溝通
練習說明
使用自訂的
theme()呼叫與element_text():- 將文字的字型
family改為"Bookman"。 - 另外,把標題與註解的
color分別改為"gray25"與"gray30"。 - 讓副標題稍微大一點,將
size提高到 12。
- 將文字的字型
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
ilo_plot <- ilo_plot +
theme_minimal() +
# Customize the "minimal" theme with another custom "theme" call
theme(
text = element_text(___ = ____),
title = element_text(___ = ____),
plot.caption = element_text(___ = ___),
plot.subtitle = element_text(___ = ____)
)
# Render the plot object
ilo_plot