result <- roc_curve_survival(
  lung_surv,
  truth = surv_obj,
  .pred
)
result
# ---------------------------------------------------------------------------
# `autoplot()`
# Visualize the curve using ggplot2 manually
library(ggplot2)
library(dplyr)
result %>%
  mutate(.eval_time = format(.eval_time)) %>%
  ggplot(aes(
    x = 1 - specificity, y = sensitivity,
    group = .eval_time, col = .eval_time
  )) +
  geom_step(direction = "hv") +
  geom_abline(lty = 3) +
  coord_equal() +
  theme_bw()
# Or use autoplot
autoplot(result)
Run the code above in your browser using DataLab