Skip to content

Instantly share code, notes, and snippets.

@selfawaresoup
Last active December 19, 2024 23:52

Revisions

  1. selfawaresoup revised this gist Dec 19, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions run_intervals.r
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    library(ggplot2)
    library(dplyr)
    library(tidyr)
    library(viridis)

    interval_plot <- function() {
    tibble(
  2. selfawaresoup revised this gist Dec 19, 2024. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions run_intervals.r
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    library(ggplot2)
    library(dplyr)
    library(tidyr)

    interval_plot <- function() {
    tibble(
    interval = c("Warm-up", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Work", "Recovery", "Finish"),
  3. selfawaresoup created this gist Dec 19, 2024.
    16 changes: 16 additions & 0 deletions run_intervals.r
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    interval_plot <- function() {
    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),
    "2024-12-11" = c(500, 700, 100, 700, 100, 700, 100, 700, 100, 700, 100, 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()
    }