Syntax
√输入1:
install.packages("survival")
library(survival)
install.packages("survminer")
library(survminer)
fittime, status) ~ sex, data = lung)
ggsurvplot(fit, fun = "pct", title = " Survival Curves",
font.title = c(16, "bold", "darkblue"),
pval = "P=0.001", = TRUE,.style = "step", palette = "lancet",
surv.median.line = "hv", cumevents = TRUE, ncensor.plot = TRUE,censor.shape = "+",
risk.table = TRUE,tables.height = 0.18,
risk.table.col = "strata",
risk.table.y.text.col = TRUE, cumevents.col ="strata",
font.x = c(14, "bold.italic", "red"),
font.y = c(14, "bold.italic", "darkred"),
font.tickslab = c(12, "plain", "darkgreen"),
legend.title = "Sex",
legend.labs = c("Male","Female"),legend = "top")fun= "event" for cumulative events,"cumhaz" for the cumulative hazard function or "pct" for survival probability in percentage.
√结果1:

√输入2:
splots splots[[1]] risk.table = TRUE,
tables.y.text = FALSE,
ggtheme = theme_light())
splots[[2]] risk.table = TRUE,
tables.y.text = FALSE,
ggtheme = theme_grey())
arrange_ggsurvplots(splots, print = TRUE,
ncol = 2, nrow = 1, risk.table.height = 0.25)√结果2:

√输入3:From survminer v0.4.0
lung1 <- lunglung1$sex <-as.factor( ifelse(lung1$sex == 1,"Male", "Female"))fit2 <- coxph(Surv(time, status) ~sex + age,data = lung1)ggcoxadjustedcurves(fit2, data=lung1,variable=lung1$sex,legend.title = "Sex", palette = "jco",individual.curves=TRUE,curve.size=1, curve.alpha=0.05,ggtheme=theme_gray())The function ggcoxadjustedcurves() from the survminer package plots
Adjusted Survival Curves for Cox Proportional Hazards Model. Adjusted
Survival Curves show how a selected factor influences survival estimated
from a Cox model.
Note that these curves differ from Kaplan Meier estimates since they
present expected survival based on given Cox model.
√结果3:

















