Intro Thoughts

library(tidyverse)
`🔥` <- function(){
  
  "ouch"
}

`🔥`()
## [1] "ouch"
`🎨` <- function(color){aes(color = {{color}})}
`↕` <- function(y){aes(color = {{y}})}
`↔` <- function(x){aes(color = {{x}})}
`📜`<- function(label){aes(color = {{label}})}


`🎨`(animal)
## Aesthetic mapping: 
## * `colour` -> `animal`

Status Quo

library(tidyverse)

data.frame(
    x = rnorm(20),
    y = rnorm(20),
    shape = rep(c("smiley", "poop"), 10)
) |> 
    ggplot(aes(x, y, shape = shape)) +
    geom_point(size = 10) +
    scale_shape_manual(
        labels = c(smiley = "Completed Study", poop = "Pooped"),
        values = c(smiley = "😀", poop = "💩"),
        guide = guide_legend(override.aes = list(size = 5))
    ) +
    theme_classic()

library(grid)
grid.newpage()
grid.points(.5, .5, pch = "😀", default.units = "npc")

library(ggswim)
p <- patient_data |>
  ggplot() +
  geom_swim_lane(
    mapping = aes(
      x = start_time, y = pt_id, xend = end_time,
      colour = disease_assessment
    )
  ) 

all_events <- dplyr::bind_rows(
  infusion_events,
  end_study_events
)

p +
  geom_swim_marker(
    data = all_events,
    aes(x = time_from_initial_infusion, y = pt_id, marker = label),
    size = 5
  )

geom_swim_marker
## function (mapping = NULL, data = NULL, stat = "identity", position = "identity", 
##     ..., check_overlap = FALSE, size.unit = "mm", na.rm = FALSE, 
##     show.legend = NA, inherit.aes = TRUE) 
## {
##     layer(data = data, mapping = mapping, stat = stat, geom = GeomSwimMarker, 
##         position = position, show.legend = show.legend, inherit.aes = inherit.aes, 
##         params = list2(check_overlap = check_overlap, size.unit = size.unit, 
##             na.rm = na.rm, ...))
## }
## <bytecode: 0x7f8be672acb8>
## <environment: namespace:ggswim>
GeomSwimMarker
## <ggproto object: Class GeomSwimMarker, GeomText, Geom, gg>
##     aesthetics: function
##     default_aes: uneval
##     draw_group: function
##     draw_key: function
##     draw_layer: function
##     draw_panel: function
##     extra_params: na.rm
##     handle_na: function
##     non_missing_aes: angle
##     optional_aes: 
##     parameters: function
##     rename_size: FALSE
##     required_aes: x y marker
##     setup_data: function
##     setup_params: function
##     use_defaults: function
##     super:  <ggproto object: Class GeomText, Geom, gg>
last_plot() + 
   scale_marker_discrete(
    glyphs = c("⬤", "⬤", "⚠️", "❌" ,"✅"),
    colours = c("#ffde00", "#ed207f", NA, NA, NA),
    limits = c("First Reinfusion", "Second Reinfusion", "Other End Study Reason", "Deceased", "Completed Study Follow-Up"),
    name = "Study Events"
  )

Experiment

Closing remarks, Other Relevant Work, Caveats