add_risktable_strata_symbol: Use Symbol for Strata in Risk Table

View source: R/add_risktable_strata_symbol.R

add_risktable_strata_symbolR Documentation

Use Symbol for Strata in Risk Table

Description

Replace the stratum level names with a color symbol in the risk tables. Use this function when stratum level names are long.

Usage

add_risktable_strata_symbol(
  symbol = NULL,
  size = 15,
  face = "bold",
  vjust = 0.3,
  ...
)

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()

Value

a ggplot2 figure

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)


ggsurvfit documentation built on Nov. 2, 2023, 5:33 p.m.