S3 method for highlighting a specific strata by lowering the opacity of all other strata.
Usage
add_highlight(gg, ...)
# S3 method for ggsurvfit
add_highlight(gg = NULL, strata = NULL, bg_alpha = 0.2, ...)
Arguments
- gg
A ggplot created with visR
- ...
other arguments passed on to the method
- strata
String representing the name and value of the strata to be highlighted as shown in the legend.
- bg_alpha
A numerical value between 0 and 1 that is used to decrease the opacity off all strata not chosen to be highlighted in
strata
. The other strata's existing alpha values are multiplied bybg_alpha
to decrease their opacity, highlighting the target strata. This works on bothcolour
andfill
properties, as for example present after applyingvisR::add_CI()
.
Examples
adtte %>%
visR::estimate_KM(strata = "SEX") %>%
visR::visr() %>%
visR::add_CI(alpha = 0.4) %>%
visR::add_highlight(strata = "M", bg_alpha = 0.2)
strata <- c("Placebo", "Xanomeline Low Dose")
adtte %>%
visR::estimate_KM(strata = "TRTP") %>%
visR::visr() %>%
visR::add_CI(alpha = 0.4) %>%
visR::add_highlight(strata = strata, bg_alpha = 0.2)