Draw a survfit object using draw_scatter.
Usage
draw_survfit(
x,
mode = "lines",
symbol = "cross",
line_shape = "hv",
xlim = NULL,
ylim = NULL,
xlab = "Time",
ylab = "Survival",
main = NULL,
legend_xy = c(1, 1),
legend_xanchor = "right",
legend_yanchor = "top",
theme = choose_theme(),
nrisk_table = FALSE,
filename = NULL,
...
)Arguments
- x
survfitobject created by survival::survfit.- mode
Character, vector: "markers", "lines", "markers+lines".
- symbol
Character: Symbol to use for the points.
- line_shape
Character: Line shape for line plots. Options: "linear", "hv", "vh", "hvh", "vhv".
- xlim
Numeric vector of length 2: x-axis limits.
- ylim
Numeric vector of length 2: y-axis limits.
- xlab
Character: x-axis label.
- ylab
Character: y-axis label.
- main
Character: Main title.
- legend_xy
Numeric: Position of legend.
- legend_xanchor
Character: X anchor for legend.
- legend_yanchor
Character: Y anchor for legend.
- theme
Themeobject.- nrisk_table
Logical: If
TRUE, subplot a table of the number at risk at each time point.- filename
Character: Filename to save plot.
- ...
Additional arguments passed to draw_scatter.
Examples
if (FALSE) { # \dontrun{
# Get the lung dataset
data(cancer, package = "survival")
sf1 <- survival::survfit(survival::Surv(time, status) ~ 1, data = lung)
draw_survfit(sf1)
sf2 <- survival::survfit(survival::Surv(time, status) ~ sex, data = lung)
draw_survfit(sf2)
# with N at risk table
draw_survfit(sf2)
} # }