```{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 { 35 } • Source: Power Rangers: Seasons and episodes data<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("Exploring Individual Word Trends Across 27 Seasons of Power Rangers")
subtitle_text <- str_glue("Tracking the top 10 words and how they evolve independently over time in\nepisode descriptions")
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 = 14, base_family = "text"))
theme_update(
plot.title.position = "plot",
plot.caption.position = "plot",
legend.position = 'plot',
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 = 20, b = 20, l = 20),
axis.title.x = element_text(margin = margin(10, 0, 0, 0), size = rel(1.1), color = text_col, family = "text", face = "bold", hjust = 0.5),
axis.title.y = element_text(margin = margin(0, 10, 0, 0), size = rel(1.1), color = text_col, family = "text", face = "bold", hjust = 0.5),
axis.text = element_text(size = rel(0.8), color = text_col, family = "text"),
axis.line.x = element_line(color = "gray40", linewidth = .15),
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_line(linetype = "dotted", linewidth = 0.1, color = 'gray'),
panel.grid.minor.x = element_blank(),
panel.grid.major.x = element_blank(),
strip.text = element_textbox(size = rel(1),
face = 'bold',
color = text_col,
hjust = 0.5,
halign = 0.5,
r = unit(5, "pt"),
width = unit(5.5, "npc"),
padding = margin(3, 0, 3, 0),
margin = margin(3, 3, 3, 3),
fill = "transparent"),
panel.spacing = unit(1, 'lines')
)
```