library("survminer")
## Loading required package: ggplot2
## Loading required package: ggpubr
## Loading required package: magrittr
km<- read.csv("km.csv")
require("survival")
## Loading required package: survival
fit <- survfit(Surv(hr, event) ~ group, data = km)
ggsurvplot(
fit, # survfit object with calculated statistics.
data = km, # data used to fit survival curves.
risk.table = TRUE, # show risk table.
pval = FALSE, # show p-value of log-rank test.
conf.int = TRUE, # show confidence intervals for
# point estimates of survival curves.
xlim = c(0,30),
ylim = c(0,1),# present narrower X axis, but not affect
# survival estimates.
xlab = "Time (hour)", # customize X axis label.
ylab = "Survival probability",
legend.labs =
c("Control", "DM", "DMDX"),
break.time.by = 1, # break X axis in time intervals by 60.
ggtheme = theme_light(), # customize plot and risk table with a theme.
risk.table.y.text.col = T, # colour risk table text annotations.
risk.table.y.text = FALSE, # show bars instead of names in text annotations
surv.median.line = "hv")
