Learn R Programming

hesim (version 0.5.5)

autoplot.survival: Plot survival curves

Description

Quickly plot survival curves stored in a survival object.

Usage

# S3 method for survival
autoplot(
  object,
  labels = NULL,
  ci = FALSE,
  prob = 0.95,
  ci_style = c("ribbon", "line"),
  geom_alpha = 0.3,
  ...
)

Value

A ggplot object.

Arguments

object

A survival object.

labels

A list of named vectors containing the values and labels of variables. The elements of each vector are the values of a variable and the names are the labels. The names of the list are the names of the variables. See the output returned by get_labels() for an example.

ci

A logical value indicating whether confidence intervals should be plotted. Default is FALSE.

prob

A numeric scalar in the interval (0,1) giving the confidence interval. Default is 0.95 for a 95 percent interval.

ci_style

Style to use for the confidence interval if ci = TRUE. If "line", then dashed lines are used; if "ribbon", then shaded confidence bands are plotted using ggplot2::geom_ribbon().

geom_alpha

The opacity for the shaded confidence bands when ci_style = "ribbon". This is the value of the value of the alpha aesthetic passed to ggplot2::geom_ribbon().

...

Further arguments passed to and from methods. Currently unused.

See Also

Psm for an example.