我绘制了一个图表,并想自定义此图的图例。我将感谢所有帮助。谢谢!
library("survival")
library("ggplot2")
library("ggfortify")
data(lung)
lung$SurvObj <- with(lung, Surv(time, status == 2))
km.by.sex <- survfit(SurvObj ~ sex, data = lung, conf.type = "log-log")
gender.plot <- autoplot(km.by.sex)
gender.plot <- gender.plot +
ggtitle("Gender based Survival (1=male, 2=female)") +
labs(x = "Time", y = "Survival Probability")
print(gender.plot)