Author

Joe

Published

May 7, 2025

Code
start_time <- Sys.time()

tidy_packages <- c("readr","tidyr","stringr","ggplot2","dplyr")

required_packages <- c(
    "gt",
    "googlesheets4",
    "lubridate",
    "plotly",
    tidy_packages 
)

invisible(lapply(required_packages, library, character.only=TRUE))

options(scipen = 10L)

# Wong, B. Points of view: Color blindness. Nat Methods (2011).
bla <- '#000000'
blu <- '#0072b2'
grb <- '#56b4e9'
lir <- '#cc79a7'
gre <- '#009e73'
red <- '#d55e00'
org <- '#e69f00'
yel <- '#f0e442'
gry <- '#BBBBBB'

jam_cols   <- c(red,blu,gre,org,grb,lir,gry,bla)
jam_shapes <- c(21,22,23,24,25)

options(ggplot2.discrete.colour = jam_cols)
options(ggplot2.discrete.fill = jam_cols)

jam_theme <- theme_minimal() +
               theme(text=element_text(size=14),axis.text=element_text(size=12),
                     axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)),
                         axis.title.x = element_text(margin = margin(t = 10, r = 0, b = 0, l = 0))) +
             theme(plot.background = element_rect(fill = "#eff3ff"))

jam_theme_bw <- theme_bw() +
                    theme(text=element_text(size=14),axis.text=element_text(size=12),
                        axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)),
                                axis.title.x = element_text(margin = margin(t = 10, r = 0, b = 0, l = 0))) +
                theme(plot.background = element_rect(fill = "#eff3ff"))

jam_theme_45 <- theme(axis.text.x = element_text(angle = 45, hjust = 1), plot.margin = margin(10, 10, 10, 50))


# Create color pallete based on lineup image @ https://coolors.co/image-picker
my_cols <- c("#52BFEC","#AA1880","#EC0059","#08BCDF","#4C1064", "#FF00BC", "#2249CD","#53007D", "#FF6B02","#B319B2","#EAE100", "#BF068F")

Data Munge

Code
set_times_full <- read_sheet("https://docs.google.com/spreadsheets/d/12Mrp81DWWDFkI8LRtVjuDONh2stZYRVY8VxrpvtcrLM/edit?usp=sharing", sheet = "set_times", col_types = "ccccc")
names(set_times_full) <- snakecase::to_snake_case(names(set_times_full))

set_times <- set_times_full |>
  mutate(day = case_when(day == "Friday" ~ "2025-05-16",
                         day == "Saturday" ~ "2025-05-17",
                         day == "Sunday" ~ "2025-05-18"),
         start_time = ifelse(str_detect(start_time, ":"), start_time, paste0(start_time, ":00")),
         stop_time = ifelse(str_detect(stop_time, ":"), stop_time, paste0(stop_time, ":00")),
         start_time = as_datetime(paste0(day, " ", paste0(start_time, ":00"))),
         stop_time = as_datetime(paste0(day, " ", paste0(stop_time, ":00"))))

set_times <- set_times |>
  mutate(start_time = case_when(day == "2025-05-16" & start_time > as_datetime("2025-05-16 06:00:00") ~ start_time + hours(12),
                                day == "2025-05-17" & start_time > as_datetime("2025-05-17 06:00:00") ~ start_time + hours(12),
                                day == "2025-05-18" & start_time > as_datetime("2025-05-18 06:00:00") ~ start_time + hours(12),
                                .default = start_time),
         stop_time = case_when(day == "2025-05-16" & stop_time > as_datetime("2025-05-16 06:00:00") ~ stop_time + hours(12),
                               day == "2025-05-17" & stop_time > as_datetime("2025-05-17 06:00:00") ~ stop_time + hours(12),
                               day == "2025-05-18" & stop_time > as_datetime("2025-05-18 06:00:00") ~ stop_time + hours(12),
                                .default = stop_time))

set_times <- set_times |>
  mutate(start_time = case_when(day == "2025-05-16" & start_time < as_datetime("2025-05-16 18:00:00") ~ start_time + days(1),
                                day == "2025-05-17" & start_time < as_datetime("2025-05-17 18:00:00") ~ start_time + days(1),
                                day == "2025-05-18" & start_time < as_datetime("2025-05-18 18:00:00") ~ start_time + days(1),
                                .default = start_time),
         stop_time = case_when(day == "2025-05-16" & stop_time < as_datetime("2025-05-16 18:00:00") ~ stop_time + days(1),
                               day == "2025-05-17" & stop_time < as_datetime("2025-05-17 18:00:00") ~ stop_time + days(1),
                               day == "2025-05-18" & stop_time < as_datetime("2025-05-18 18:00:00") ~ stop_time + days(1),
                                .default = stop_time)) |>  
  mutate(start_time_12hr = format(start_time, "%I:%M %p"),
         stop_time_12hr = format(stop_time, "%I:%M %p")) |> 
  mutate(time_label_12hr = paste0(start_time_12hr, " - ", stop_time_12hr),
         time_label_position = start_time + (difftime(stop_time, start_time) /2)) |>
  arrange(start_time) |>
  mutate(dupl = if_else(duplicated(artist), 1, 0)) |> 
  group_by(artist) |> 
  mutate(dupl = cumsum(dupl),
         artist = paste(artist, dupl, sep = " - "),
         artist = str_remove(artist, " - 0")) |> 
  select(-dupl) |>
  ungroup()

set_times <- set_times |>
  mutate(artist = factor(artist, levels = rev(set_times$artist)))

big_stages <- c("bassPOD","circuitGROUNDS","cosmicMEADOW","kineticFIELD","neonGARDEN","quantumVALLEY","stereoBLOOM","wasteLAND")
#small_stages <- c("bassPOD","BeatboxArtCar","bionicJUNGLE","BlacklightBar","circuitGROUNDS","cosmicMEADOW","ForestHouse","kineticFIELD","Metaphoenix","neonGARDEN","quantumVALLEY","stereoBLOOM","Ubuntu","wasteLAND","yeEDC!")

set_times_16 <- filter(set_times, day == "2025-05-16")#, stage %in% big_stages)
set_times_17 <- filter(set_times, day == "2025-05-17")#, stage %in% big_stages)
set_times_18 <- filter(set_times, day == "2025-05-18")#, stage %in% big_stages)


# filter(set_times, stage == "bassPOD")
# filter(set_times, day == "2025-05-16", stage == "bassPOD")

votes <- read_sheet("https://docs.google.com/spreadsheets/d/12Mrp81DWWDFkI8LRtVjuDONh2stZYRVY8VxrpvtcrLM/edit?usp=sharing", sheet = "votes", col_types = "cccccccccccc")
names(votes) <- snakecase::to_snake_case(names(votes))

votes <- votes  |> 
  mutate(dupl = if_else(duplicated(artist), 1, 0)) |> 
  group_by(artist) |> 
  mutate(dupl = cumsum(dupl),
         artist = paste(artist, dupl, sep = " - "),
         artist = str_remove(artist, " - 0")) |> 
  select(-dupl) |>
  ungroup()
Code
voter.stats <- function(person){
  
  voter <- filter(votes, !is.na(!!sym(person))) |>
    inner_join(set_times)
  
  d1 <- tibble(n = sum(as.numeric(voter[[person]]))) |>
    gt() |>
    tab_header("total votes")
  
  print(htmltools::tagList(d1))
  

  d1 <- voter |>
    count(!!sym(person)) |>
    gt() |>
    tab_header("number of votes 1 through 5")
  
  print(htmltools::tagList(d1))
  
  
  d1 <- voter |>
    group_by(stage) |>
    summarise(n = sum(as.numeric(!!sym(person)))) |>
    arrange(desc(n)) |>
    gt() |>
    tab_header("number of votes by stage")
  
  print(htmltools::tagList(d1))
  
  d1 <- voter |>
    group_by(day) |>
    summarise(n = sum(as.numeric(!!sym(person)))) |>
    arrange(day) |>
    gt() |>
    tab_header("number of votes by day")
  
  print(htmltools::tagList(d1))
  
  d1 <- voter |>
    filter(as.numeric(!!sym(person)) >=4) |>
    select(artist, all_of(person), stage, day, start_time_12hr, stop_time_12hr) |>
    arrange(day, start_time_12hr) |>
    gt() |>
    tab_header("artists with 4s and 5s")
  
  print(htmltools::tagList(d1))
 
  
}

vote_colors <- c("#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177")

plot.personal.conflicts <- function(person){

i_set_times <- set_times_16

voter <- filter(votes, !is.na(!!sym(person))) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% voter$artist)

p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-16 19:00:00"), xend = as_datetime("2025-05-17 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = !!sym(person)), alpha = 0.5) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_manual(values = vote_colors) +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Friday")
print(p1)


i_set_times <- set_times_17

voter <- filter(votes, !is.na(!!sym(person))) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% voter$artist)


p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-17 19:00:00"), xend = as_datetime("2025-05-18 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = !!sym(person)), alpha = 0.5) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_manual(values = vote_colors) +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Saturday")
print(p1)


i_set_times <- set_times_18

voter <- filter(votes, !is.na(!!sym(person))) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% voter$artist)


p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-18 19:00:00"), xend = as_datetime("2025-05-19 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = !!sym(person)), alpha = 0.5) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_manual(values = vote_colors) +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Sunday")
print(p1)

}

Kimiko

Code
person <- "votes_kimiko"

voter.stats(person)
total votes
n
126
number of votes 1 through 5
votes_kimiko n
1 22
2 19
3 12
4 5
5 2
number of votes by stage
stage n
cosmicMEADOW 32
bassPOD 29
circuitGROUNDS 25
kineticFIELD 23
stereoBLOOM 10
neonGARDEN 3
Metaphoenix 2
quantumVALLEY 2
number of votes by day
day n
2025-05-16 41
2025-05-17 35
2025-05-18 50
artists with 4s and 5s
artist votes_kimiko stage day start_time_12hr stop_time_12hr
Dom Dolla 5 kineticFIELD 2025-05-16 01:47 AM 02:57 AM
RL Grime 4 cosmicMEADOW 2025-05-16 11:15 PM 12:30 AM
ISOKNOCK 5 circuitGROUNDS 2025-05-17 01:27 AM 02:27 AM
Chase & Status 4 bassPOD 2025-05-17 12:30 AM 01:30 AM
Disco Lines 4 cosmicMEADOW 2025-05-18 04:30 AM 05:30 AM
Levity 4 bassPOD 2025-05-18 09:30 PM 10:30 PM
Loud Luxury 4 cosmicMEADOW 2025-05-18 12:00 AM 01:00 AM
Code
plot.personal.conflicts(person)

Joe

Code
person <- "votes_joe"

voter.stats(person)
total votes
n
97
number of votes 1 through 5
votes_joe n
1 1
2 9
3 13
4 6
5 3
number of votes by stage
stage n
bassPOD 27
cosmicMEADOW 25
kineticFIELD 22
circuitGROUNDS 18
Metaphoenix 3
bionicJUNGLE 2
number of votes by day
day n
2025-05-16 25
2025-05-17 28
2025-05-18 44
artists with 4s and 5s
artist votes_joe stage day start_time_12hr stop_time_12hr
NGHTMRE 5 cosmicMEADOW 2025-05-16 04:15 AM 05:30 AM
RL Grime 5 cosmicMEADOW 2025-05-16 11:15 PM 12:30 AM
ISOKNOCK 5 circuitGROUNDS 2025-05-17 01:27 AM 02:27 AM
Illenium b2b SLANDER 4 kineticFIELD 2025-05-17 01:47 AM 02:57 AM
Rezz 4 circuitGROUNDS 2025-05-17 12:05 AM 01:15 AM
Alison Wonderland b2b Kaskade 4 cosmicMEADOW 2025-05-18 01:00 AM 02:30 AM
Slander b2b NGHTMRE 4 circuitGROUNDS 2025-05-18 01:15 AM 02:45 AM
Rudim3ntal 4 bassPOD 2025-05-18 03:30 AM 04:30 AM
Martin Garrix 4 kineticFIELD 2025-05-18 12:11 AM 01:41 AM
Code
plot.personal.conflicts(person)

Steve

Code
person <- "votes_steve"

voter.stats(person)
total votes
n
70
number of votes 1 through 5
votes_steve n
1 1
2 10
3 12
4 2
5 1
number of votes by stage
stage n
cosmicMEADOW 19
circuitGROUNDS 13
kineticFIELD 10
bassPOD 9
bionicJUNGLE 5
neonGARDEN 5
Forest House 4
Metaphoenix 3
quantumVALLEY 2
number of votes by day
day n
2025-05-16 24
2025-05-17 27
2025-05-18 19
artists with 4s and 5s
artist votes_steve stage day start_time_12hr stop_time_12hr
ISOKNOCK 5 circuitGROUNDS 2025-05-17 01:27 AM 02:27 AM
Chase & Status 4 bassPOD 2025-05-17 12:30 AM 01:30 AM
Gesaffelstein 4 cosmicMEADOW 2025-05-17 12:45 AM 01:56 AM
Code
plot.personal.conflicts(person)

Katie

Required listening for Katie!!!!!

ISOKNOCK (Knock2 is better than ISOxo but their collabs are good too, especially with RL Grime)

Link to Spotify playlist

Code
person <- "votes_katie"

voter.stats(person)
total votes
n
129
number of votes 1 through 5
votes_katie n
1 26
2 25
3 8
4 6
5 1
number of votes by stage
stage n
cosmicMEADOW 29
circuitGROUNDS 22
bassPOD 21
kineticFIELD 21
stereoBLOOM 14
neonGARDEN 9
Blacklight Bar 3
Forest House 3
quantumVALLEY 3
Beatbox Art Car 2
Metaphoenix 1
wasteLAND 1
number of votes by day
day n
2025-05-16 42
2025-05-17 40
2025-05-18 47
artists with 4s and 5s
artist votes_katie stage day start_time_12hr stop_time_12hr
Dom Dolla 4 kineticFIELD 2025-05-16 01:47 AM 02:57 AM
Biscits 4 stereoBLOOM 2025-05-16 02:00 AM 03:15 AM
ISOKNOCK 4 circuitGROUNDS 2025-05-17 01:27 AM 02:27 AM
Bicep present Chroma 4 cosmicMEADOW 2025-05-17 09:10 PM 10:40 PM
The Martinez Brothers b2b Loco Dice 4 neonGARDEN 2025-05-17 12:30 AM 03:00 AM
Levity 4 bassPOD 2025-05-18 09:30 PM 10:30 PM
Of The Trees 5 bassPOD 2025-05-18 11:30 PM 12:30 AM
Code
plot.personal.conflicts(person)

Chantel

Code
person <- "votes_chantel"

voter.stats(person)
total votes
n
81
number of votes 1 through 5
votes_chantel n
3 11
4 7
5 4
number of votes by stage
stage n
kineticFIELD 18
stereoBLOOM 18
bassPOD 14
cosmicMEADOW 14
circuitGROUNDS 7
wasteLAND 7
Ubuntu 3
number of votes by day
day n
2025-05-16 40
2025-05-17 22
2025-05-18 19
artists with 4s and 5s
artist votes_chantel stage day start_time_12hr stop_time_12hr
Caspa b2b Rusko 4 bassPOD 2025-05-16 02:30 AM 03:30 AM
Shlømo 4 wasteLAND 2025-05-16 03:30 AM 04:30 AM
Jackie Hollander 5 stereoBLOOM 2025-05-16 08:00 PM 09:15 PM
RL Grime 5 cosmicMEADOW 2025-05-16 11:15 PM 12:30 AM
Matroda & Friends 4 stereoBLOOM 2025-05-16 11:30 PM 12:45 AM
Illenium b2b SLANDER 4 kineticFIELD 2025-05-17 01:47 AM 02:57 AM
Bicep present Chroma 5 cosmicMEADOW 2025-05-17 09:10 PM 10:40 PM
Rezz 4 circuitGROUNDS 2025-05-17 12:05 AM 01:15 AM
Matroda 4 cosmicMEADOW 2025-05-18 02:30 AM 03:30 AM
Rudim3ntal 4 bassPOD 2025-05-18 03:30 AM 04:30 AM
ARTBAT b2b MORTEN 5 kineticFIELD 2025-05-18 10:00 PM 11:00 PM
Code
plot.personal.conflicts(person)

Group Votes

Code
plot.group.conflicts <- function(){

i_set_times <- set_times_16

group_voter <- select(votes, c(artist, contains("votes"))) |>
  pivot_longer(!artist, names_to = "voter", values_to = "vote") |>
  filter(!is.na(vote)) |>
  group_by(artist) |>
  summarise(sum_votes = sum(as.numeric(vote), na.rm = T)) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% group_voter$artist)

p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-16 19:00:00"), xend = as_datetime("2025-05-17 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=group_voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = sum_votes), alpha = 0.5) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_gradient(low = "#feebe2", high = "#7a0177") +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Friday")
print(p1)

i_set_times <- set_times_17

group_voter <- select(votes, c(artist, contains("votes"))) |>
  pivot_longer(!artist, names_to = "voter", values_to = "vote") |>
  filter(!is.na(vote)) |>
  group_by(artist) |>
  summarise(sum_votes = sum(as.numeric(vote), na.rm = T)) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% group_voter$artist)

p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-17 19:00:00"), xend = as_datetime("2025-05-18 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=group_voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = sum_votes), alpha = 0.5) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_gradient(low = "#feebe2", high = "#7a0177") +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Saturday")
print(p1)


i_set_times <- set_times_18

group_voter <- select(votes, c(artist, contains("votes"))) |>
  pivot_longer(!artist, names_to = "voter", values_to = "vote") |>
  filter(!is.na(vote)) |>
  group_by(artist) |>
  summarise(sum_votes = sum(as.numeric(vote), na.rm = T)) |>
  inner_join(i_set_times)

i_set_times <- i_set_times |>
  filter(artist %in% group_voter$artist)

p1 <- ggplot() +
  geom_segment(data=i_set_times, aes(x = as_datetime("2025-05-18 19:00:00"), xend = as_datetime("2025-05-19 06:00:00"),
                                   y= artist, yend = artist), linewidth = 1, color = gry) + 
  geom_segment(data=i_set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2, color = gry) +
  geom_label(data=i_set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +
  geom_rect(data=group_voter, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = sum_votes), alpha = 0.5) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_gradient(low = "#feebe2", high = "#7a0177") +
  jam_theme_bw +
  jam_theme_45 +
  ylab("") + xlab("") +
  ggtitle("Sunday")
print(p1)

}
Code
plot.group.conflicts()

Festiplanner

Fesitplanner link

Notes

Code
set_times <- readxl::read_xlsx("C:/Users/joseph.mcgirr/Personal/R_fun/edc_2025/example_set_times.xlsx") |> 
  arrange(start_time) |>
  mutate(schedule_joe = as.character(schedule_joe),
         schedule_kimiko = as.character(schedule_kimiko)) 

date(set_times$start_time) <- set_times$day
date(set_times$stop_time) <- set_times$day

# filter(set_times, start_time < as_datetime("2024-05-16 06:00:00"))
# filter(set_times, start_time < as_datetime("2024-05-16 18:00:00"))

set_times <- set_times |>
  mutate(start_time = case_when(start_time > as_datetime("2024-05-16 06:00:00") ~ start_time + hours(12),
                                .default = start_time),
         stop_time = case_when(stop_time > as_datetime("2024-05-16 06:00:00") ~ stop_time + hours(12),
                                .default = stop_time))

set_times <- set_times |>
  mutate(start_time = case_when(start_time < as_datetime("2024-05-16 18:00:00") ~ start_time + days(1),
                                .default = start_time),
         stop_time = case_when(stop_time < as_datetime("2024-05-16 18:00:00") ~ stop_time + days(1),
                                .default = stop_time)) |>  
  mutate(start_time_12hr = format(start_time, "%I:%M %p"),
         stop_time_12hr = format(stop_time, "%I:%M %p")) |> 
  mutate(time_label_12hr = paste0(start_time_12hr, " - ", stop_time_12hr),
         time_label_position = start_time + (difftime(stop_time, start_time) /2)) |>
  arrange(start_time)


# set_times <- set_times |>
#   mutate(start_time = case_when(start_time > as_datetime("2024-05-16 12:00:00") ~ start_time + hours(12),
#                                 start_time < as_datetime("2024-05-16 12:00:00") ~ start_time + hours(12)),
#          stop_time = case_when(stop_time > as_datetime("2024-05-16 12:00:00") ~ stop_time + hours(12),
#                                stop_time < as_datetime("2024-05-16 12:00:00") ~ stop_time + days(1))) |>
#   mutate(start_time = format(start_time, "%Y-%m-%d %I:%M %p"),
#          stop_time = format(stop_time, "%Y-%m-%d %I:%M %p")) |> 
#   arrange(start_time)

set_times <- set_times |>
  mutate(artist = factor(artist, levels = rev(set_times$artist)))
                    

# before_midnight <- set_times |> 
#   filter(start_time > as_datetime("2024-05-16 06:00:00")) |> 
#   mutate(start_time = start_time + hours(12)) |>
#   arrange(day, start_time)
#   
# after_midnight <- set_times |> 
#   filter(start_time < as_datetime("2024-05-16 06:00:00")) |> 
#   mutate(start_time = start_time + days(1)) |>
#   arrange(day, start_time)
#   
# set_times <- bind_rows(before_midnight, after_midnight) |>
#   arrange(day, start_time)
                                


# one plot for each person

# another plot where scores are added and rect is colored on continuous heatmap scale

joe <- filter(set_times, !is.na(schedule_joe))# |>
  #select(-c(stage))


ggplot() +
  geom_segment(data=set_times, aes(x = as_datetime("2024-05-16 19:00:00"), xend = as_datetime("2024-05-17 06:00:00"),
                                   y= artist, yend = artist, color = artist), linewidth = 3) + 
  geom_segment(data=set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2) +
  geom_label(data=set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +

  geom_rect(data=joe, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  #geom_rect(data=kimiko, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = schedule_joe), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free_y") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_manual(values = c("1" = gre, "2" = yel, "3" = gry)) +
  #scale_color_manual(values = rep(my_cols,3)) +
  jam_theme_bw +
  #jam_theme_45 +
  theme(legend.position = "none") +
  ylab("") + xlab("")



joe <- filter(set_times, !is.na(schedule_joe))# |>
  #select(-c(stage))
kimiko <- filter(set_times, !is.na(schedule_kimiko))# |>
  #select(-c(stage))

sum_votes <- full_join(joe, kimiko) |>
  mutate(schedule_joe = ifelse(is.na(schedule_joe), "0", schedule_joe),
         schedule_kimiko = ifelse(is.na(schedule_kimiko), "0", schedule_kimiko)) |>
  mutate(votes = as.numeric(schedule_joe) + as.numeric(schedule_kimiko))

ggplot() +
  geom_segment(data=set_times, aes(x = as_datetime("2024-05-16 19:00:00"), xend = as_datetime("2024-05-17 06:00:00"),
                                   y= artist, yend = artist, color = artist), linewidth = 3) + 
  geom_segment(data=set_times, aes(x = start_time, xend = stop_time, y = artist), linewidth = 2) +
  geom_label(data=set_times, aes(label=time_label_12hr, x=time_label_position, y = artist), size=3.5) +

  geom_rect(data=sum_votes, aes(xmin = start_time, xmax= stop_time, ymin = -Inf, ymax = Inf, fill = votes), alpha = 0.3) +
  facet_grid(rows = vars(stage), scales = "free_y") +
  scale_x_datetime(date_breaks = "1 hour", date_labels = "%I %M %p") +
  scale_fill_gradient(low = red, high = yel) +
  #scale_color_discrete(values = rep(my_cols,3)) +
  jam_theme_bw +
  #jam_theme_45 +
  theme(legend.position = "none") +
  ylab("") + xlab("")

Run time

Code
Sys.time() - start_time
Time difference of 21.17248 secs

Session

Code
sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_1.1.4         stringr_1.5.1       tidyr_1.3.1        
[4] readr_2.1.5         plotly_4.10.4       ggplot2_3.5.1      
[7] lubridate_1.9.3     googlesheets4_1.1.1 gt_0.11.0          

loaded via a namespace (and not attached):
 [1] sass_0.4.9        rappdirs_0.3.3    utf8_1.2.4        generics_0.1.3   
 [5] xml2_1.3.6        stringi_1.8.4     hms_1.1.3         digest_0.6.36    
 [9] magrittr_2.0.3    evaluate_0.24.0   grid_4.4.1        timechange_0.3.0 
[13] fastmap_1.2.0     cellranger_1.1.0  jsonlite_1.8.8    googledrive_2.1.1
[17] httr_1.4.7        purrr_1.0.4       fansi_1.0.6       viridisLite_0.4.2
[21] scales_1.3.0      lazyeval_0.2.2    cli_3.6.4         rlang_1.1.5      
[25] munsell_0.5.1     withr_3.0.1       yaml_2.3.10       tools_4.4.1      
[29] tzdb_0.4.0        gargle_1.5.2      colorspace_2.1-1  curl_5.2.1       
[33] vctrs_0.6.5       R6_2.5.1          lifecycle_1.0.4   snakecase_0.11.1 
[37] fs_1.6.4          htmlwidgets_1.6.4 pkgconfig_2.0.3   pillar_1.9.0     
[41] gtable_0.3.5      glue_1.7.0        data.table_1.15.4 xfun_0.46        
[45] tibble_3.2.1      tidyselect_1.2.1  rstudioapi_0.17.1 knitr_1.48       
[49] farver_2.1.2      htmltools_0.5.8.1 labeling_0.4.3    rmarkdown_2.27   
[53] compiler_4.4.1    askpass_1.2.0     openssl_2.2.0