更改 survminer 中标题“处于危险中的人数”的大小

sar*_*sar 2 r ggplot2

我正在使用 survminer 软件包,我想更改风险表的“风险数字”标题的字体大小。尺寸太大了。

library(survminer)
p<- ggsurvplot(fit, data = final,
                  size = 0.8, 
                  censor= FALSE, 
                  font.main = 10,
                  #font.x = 10,
                  #font.y =10,

                  legend = c (0.25,0.2), 
                  legend.title = "number", 
                  legend.labs = c ("0", "1","2","3","4","5",">=6"),

                  risk.table = TRUE, risk.table.y.col = "strata", 
                  risk.table.height = 0.3,
                  fontsize =2.5, 

                  xlim = c(0, 4), 
                  xlab = "Time in years",
                  ylab = "Treatment failure-free survival", 
                  surv.scale="percent",
                  break.time.by=1,
                  tables.theme = theme_cleantable())
p$table <-   p$table + 
  theme(
    axis.ticks.y = element_blank()#removes the axis on the risk table
  )
p$plot <- p$plot + theme(legend.key.height = unit(0.58, "line")) 
ggsave(file = "ggsurv.p.tiff", print(p)) 
Run Code Online (Sandbox Code Playgroud)

PoG*_*bas 5

更改默认主题。默认主题是theme_survminer()您必须font.main在那里更改参数,例如theme_survminer(font.main = 20)

survminer使用默认数据和代码生成绘图:

library(survminer)
require("survival")
fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(fit, data = lung, risk.table = TRUE)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

字体大小更改font.main为 ( ) 20

ggsurvplot(fit, data = lung, risk.table = TRUE, 
    tables.theme = theme_survminer(font.main = 20)) + 
    ggtitle("FOO")
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • @Marius Mariau,谢谢,我编辑了我的答案,仅修改了表格标题。 (2认同)