options(repr.plot.width=14, repr.plot.height=8)
tibble(
interval = c("Warm-up", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Finish"),
"2024-10-21" = c(500, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 500),
"2024-12-06" = c(500, 650, 150, 650, 150, 650, 150, 650, 150, 650, 150, 500)
) |>
pivot_longer(cols = starts_with("2024"), names_to = "date", values_to = "distance") |>
mutate(
interval = ordered(interval, levels = c("Warm-up", "Work", "Recovery", "Finish"))
) |>
ggplot(aes(x = distance, y = date, group = date, fill = interval)) +
geom_bar(stat = "identity") +
scale_fill_viridis(discrete = T, option = "rocket", direction = -1) +
theme_linedraw()