I need to add event rates at the end of the Kaplan Meier curves i.e. at 3 years.
Here is a sample database and my code
library(ggsurvfit);library(ggplot2); library(survival); library(survminer)
BMT<-data(BMT)
fit <- survfit(Surv(ftime/12, status >0)~ dis, data= BMT)
summary(fit,times=c(1,2,3))
a<-ggsurvplot(fit, fun= "event",
xlim = c(0,3),
xlab="Time (Months)",#axes.offset = F,
break.x.by =0.5,#xscale = "d_m",
ylim=c(0,0.90),
ylab="Primary outcome (%)", risk.table = T, #
risk.table.col = "strata",
risk.table.pos="out",
risk.table.y.text = F,
legend=c(0.15,0.8),
#legend=c(0,1),
cumevents=F,
cumevents.title ="Cumulative events",
cumevents.col ="strata",
cumevents.y.text=F,censor=F,
legend.labs = c("No","Yes"),
legend.title = "Diseased", conf.int = F, conf.int.style = "ribbon",
pval = F, pval.coord = c(2,0.2), tables.height = 0.2,
tables.theme = theme_cleantable(),
data = BMT, palette = c("blue4","red4") );a
### Change y axis to be in percent
a$plot<-a$plot+scale_y_continuous(limits = c(0, 0.9),
breaks = seq(0,0.9,by=0.1), labels = seq(0,90,by=10))+
scale_x_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3), labels = c(0,6,12,18,24,30,36));a
I expect the output to be like this
