```{r}
#| label: params
### |- plot aesthetics ----
bkg_col <- colorspace::lighten('#f7f5e9', 0.05)
title_col <- "gray20"
subtitle_col <- "gray20"
caption_col <- "gray30"
text_col <- "gray20"
### |- titles and caption ----
# icons
tt <- str_glue("#TidyTuesday: { 2024 } Week { 33 } • Source: List of world expositions (Wikipedia)<br>")
li <- str_glue("<span style='font-family:fa6-brands'></span>")
gh <- str_glue("<span style='font-family:fa6-brands'></span>")
mn <- str_glue("<span style='font-family:fa6-brands'></span>")
# text
title_text <- str_glue("Visitor Distribution by Start Month at World\\'s Fairs")
subtitle_text <- str_glue("Density of visitor counts across fairs held from 1851 to 2021")
caption_text <- str_glue("{tt} {li} stevenponce • {mn} @sponce1(graphic.social) {gh} poncest • #rstats #ggplot2")
### |- fonts ----
font_add("fa6-brands", "fonts/6.4.2/Font Awesome 6 Brands-Regular-400.otf")
font_add_google("Oswald", regular.wt = 400, family = "title")
font_add_google("Merriweather Sans", regular.wt = 400, family = "subtitle")
font_add_google("Merriweather Sans", regular.wt = 400, family = "text")
font_add_google("Noto Sans", regular.wt = 400, family = "caption")
showtext_auto(enable = TRUE)
### |- plot theme ----
theme_set(theme_minimal(base_size = 12, base_family = "text"))
theme_update(
plot.title.position = "plot",
plot.caption.position = "plot",
legend.position = "top",
legend.justification = "right",
legend.title.position = "top",
legend.title.align = 1,
legend.box.just = "right",
legend.margin = margin(5, 10, -65, 0),
plot.background = element_rect(fill = bkg_col, color = bkg_col),
panel.background = element_rect(fill = bkg_col, color = bkg_col),
plot.margin = margin(t = 20, r = 25, b = 20, l = 25),
axis.title.x = element_text(margin = margin(10, 0, 0, 0), size = rel(1.2),
color = text_col, family = "text", face = "bold", hjust = 0.5),
axis.title.y = element_text(margin = margin(0, 10, 0, 0), size = rel(1.2),
color = text_col, family = "text", face = "bold", vjust = 0.5),
axis.text = element_text(size = rel(0.95), color = text_col, family = "text"),
axis.line.x = element_line(color = "gray40", linewidth = 0.12),
panel.grid.minor.x = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line(linetype = "dotted", linewidth = 0.15, color = 'gray'),
panel.grid.minor.y = element_blank(),
)
```