geom_swimlane_text: Add text to the end of each swimlane bar

View source: R/geom_swimlane_text.R

geom_swimlane_textR Documentation

Add text to the end of each swimlane bar

Description

Most often used to annotate each bar with reason for ending study or, if applicable, active status.

Usage

geom_swimlane_text(x, y, label, ...)

Arguments

x

Typically subject identifier

y

Typically duration on study

label

Annotation text

...

Other options passed to ggtext::geom_richtext

Examples

library(ggplot2)

patient_disposition %>%
  dplyr::mutate(
    reason_off_study = tidyr::replace_na(reason_off_study, "→")
  ) %>%
  order_swimlane(subject, weeks_on_study, cohort) %>%
  ggplot() +
  geom_swimlane(subject, weeks_on_study, cohort) +
  ggsci::scale_fill_jco() +
  geom_swimlane_text(subject, weeks_on_study, reason_off_study) +
  theme_swimlane(legend.position = c(.9, .1)) %+replace%
  theme(axis.title.x = element_blank())

tgerke/ggswimlane documentation built on Aug. 8, 2022, 12:29 p.m.