## Estimate survival
surv_object <- visR::estimate_KM(data = adtte, strata = "TRTP")
## We want to annotate the survival KM plot with a simple string comment
visR::visr(surv_object) %>%
visR::add_annotation(
label = "My simple comment",
base_family = "sans",
base_size = 15,
xmin = 110,
xmax = 180,
ymin = 0.80
)
## Currently, care needs to be taken on the x-y values relative
## to the plot data area. Here we are plotting outside of the data area.
visR::visr(surv_object) %>%
visR::add_annotation(
label = "My simple comment",
base_family = "sans",
base_size = 15,
xmin = 210,
xmax = 380,
ymin = 1.0
)
## We may also want to annotate a KM plot with information
## from additional tests or estimates. This example we annotate
## with p-values contained in a tibble
## we calculate p-values for "Equality across strata"
lbl <- visR::get_pvalue(surv_object,
statlist = c("test", "pvalue"),
type = "All"
)
## display p-values
lbl
## Now annotate survival KM plot with the p-values
visR::visr(surv_object) %>%
visR::add_annotation(
label = lbl,
base_family = "sans",
base_size = 9,
xmin = 100,
xmax = 180,
ymin = 0.80
)
Run the code above in your browser using DataLab