add_quantile: Add Quantile Annotation

View source: R/add_quantile.R

add_quantileR Documentation

Add Quantile Annotation

Description

Add quantile information annotated on to the plot.

Usage

add_quantile(y_value = NULL, x_value = NULL, ...)

Arguments

y_value, x_value

Numeric value where the line segment will be drawn. Default is y_value=0.5 when both y_value and x_value are unassigned.

...

Named arguments passed to ggplot2::geom_segment() with default linetype = 2

Value

a ggplot2 figure

See Also

Visit the gallery for examples modifying the default figures

Examples

survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
  ggsurvfit() +
  add_quantile(linetype = 2) +
  scale_ggsurvfit()

survfit2(Surv(time, status) ~ 1, data = df_lung) %>%
  ggsurvfit() +
  add_quantile(linetype = 2) +
  add_quantile(y_value = 0.9, linetype = 3) +
  scale_ggsurvfit()

survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
  ggsurvfit() +
  add_quantile(linetype = 2, y_value = NULL, x_value = 10) +
  scale_ggsurvfit()

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