View source: R/geom_swimlane_text.R
geom_swimlane_text | R Documentation |
Most often used to annotate each bar with reason for ending study or, if applicable, active status.
geom_swimlane_text(x, y, label, ...)
x |
Typically subject identifier |
y |
Typically duration on study |
label |
Annotation text |
... |
Other options passed to ggtext::geom_richtext |
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())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.