Use Symbol for Strata in Risk Table
Source:R/add_risktable_strata_symbol.R
add_risktable_strata_symbol.Rd
Replace the stratum level names with a color symbol in the risk tables. Use this function when stratum level names are long.
Arguments
- symbol
UTF-8 code of shape to replace strata level with. Default is a rectangle (
"\U25AC"
). Other common options are circle ("\U25CF"
) and diamond ("\U25C6"
). While a symbol is the most common string to pass here, any string is acceptable.- size, face, vjust, ...
arguments passed to a function similar to
ggtext::element_markdown()
See also
Visit the gallery for examples modifying the default figures
Examples
p <-
survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
ggsurvfit(linewidth = 1) +
add_confidence_interval() +
add_risktable(risktable_group = "risktable_stats") +
scale_ggsurvfit()
p + add_risktable_strata_symbol()
p + add_risktable_strata_symbol(symbol = "\U25CF", size = 10)