https://www.youtube.com/watch?v=uCpYUrJVZUA&t=5s via ‘Effective data communication guide for educators, parents, and community leaders’…
{library(tidyverse)
tribble(~date, ~score, ~group,
"2021-09-01", 30, "min",
"2021-09-01", 50, "mean",
"2021-09-01", 70, "max",
"2021-10-01", 20, "min",
"2021-10-01", 60, "mean",
"2021-10-01", 80, "max") |>
mutate(date = date |> as_date(),
group = group |> fct_inorder()) |>
ggplot() +
aes(x = date,
y = score,
fill = group) +
geom_col(position = "dodge") +
labs(title = "Test Scores Over Time") +
scale_y_continuous(labels = scales::percent_format()) +
labs(y = "CLASS TEST SCORE") +
theme(axis.title.y = element_text(hjust = 1)) +
theme(plot.title.position = "plot") +
labs(x = "School year 2021-22") +
theme(axis.title.x = element_text(hjust = 0)) +
ggplyr::layers_wipe() +
aes(color = group) +
geom_line() +
aes(label = group) +
geom_label(data = . %>%
filter(date == max(date),
.by = group),
hjust = 0,
linewidth = NA,
fill = NULL,
aes(label = group))} |>
codehover::ch_hover()
## Warning in geom_label(data = . %>% filter(date == max(date), .by = group), :
## Ignoring empty aesthetic: `fill`.
| library(tidyverse) ggplot(mutate(tribble(~date, ~score, ~group, "2021-09-01", 30, |