如何在生存图中设置自定义 x 轴间隔?

How to set custom x axis interval in survival plot?

如何将 x 轴间隔更改为 1,10,20...100 而不是 0,25,50,100? 我使用以下代码生成生存图

library(survminer)
library(tibble)
library(survival)
library(data.table)

#Create dataframe
datam = data.table(ID=1:100,
                  AGE= sample(20:90, size = 100, replace = T),
                  Cancer = sample(0:1, 100, replace = T),
                  Sex = rep(c("Male","Female"), 50))
surviv <- as_tibble(datam)

#Create sfit object
sfit <- survfit(Surv(AGE, Cancer)~Sex, data=surviv)

#Plot the survival analysis
ggsurvplot(sfit, conf.int = FALSE, legend = "bottom",
           palette = c("red", "blue"),legend.title="Sex",
           risk.table = TRUE, risk.table.col = "strata",
           legend.labs=c("Male", "Female"),
           xlim=c(0,100),xscale = 1,
           ggtheme = theme_survminer(),
           xlab = "Age at Diagnosis", size=1.5,
           ylab="Cumulative Risk", pval = FALSE,
           fun = "event")

您可以使用选项 break.x.by=10

ggsurvplot(sfit, conf.int = FALSE, legend = "bottom",
           palette = c("red", "blue"),legend.title="Sex",
           risk.table = TRUE, risk.table.col = "strata",
           legend.labs=c("Male", "Female"),
           xlim=c(0,100),xscale = 1,
           ggtheme = theme_survminer(),
           xlab = "Age at Diagnosis", size=1.5,
           ylab="Cumulative Risk", pval = FALSE,
           fun = "event", break.x.by=10)