I would like to add title to ggsurvplot. Here is my code:
library(survival)
library(survminer)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(fit, data =lung, main = "This is title")
It generates plot, but without title. If add risk.table = TRUE
, then I get title on top of risk table, but not the main plot.
library(survival)
library(survminer)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(fit, data =lung, main = "This is title",
risk.table = TRUE)
Any idea how to fix it?
Call the title with title =
, not with main =
.
ggsurvplot(fit, data =lung, title = "This is title",
risk.table = TRUE)