更改风险表图例的字体大小

时间:2020-07-26 11:22:10

标签: r

# Create plots
library(survival)
library(survminer)
data(lung)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurv <- ggsurvplot(fit, risk.table = TRUE,
                     tables.theme = clean_theme())

如何增加风险表层次的字体大小?

谢谢!

2 个答案:

答案 0 :(得分:1)

因此,经过长时间的搜索,我仍然找不到解决此问题的方法,但是我仍然能够找到合适的解决方法,最终找到答案!!!

首先,解决方法: 与其在表格阶层中使用无法增加大小的文本,不如将其更改为线条的颜色,如下所示:

fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurv <- ggsurvplot(fit, risk.table = TRUE,
                     tables.theme = clean_theme())
ggsurv$table <- ggrisktable(fit, 
                             data = severeTRdb, 
                             color = "strata", 
                             y.text = F,   ylab = "",  xlab = "",
                             tables.theme = theme_cleantable(),
)
ggsurv

enter image description here

秒-答案:

fit <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurv <- ggsurvplot(fit, risk.table = TRUE,
                     tables.theme = clean_theme())
ggsurv$table <- ggrisktable(fit, 
                             data = severeTRdb, 
                             color = "strata", 
                             y.text = F,   ylab = "",  xlab = "",
                             tables.theme = theme_cleantable(),
                            font.tickslab = c(20, "bold")
)
ggsurv

enter image description here

答案 1 :(得分:0)

此解决方案如何使用ggplot2?我添加了其他主题组件,您可以通过增加或减少分配给大小的数量来进行修改。您还可以同时使用颜色和面部组件!

Library(ggplot2)

代码:

ggsurv$plot <- ggsurv$plot + 
theme(legend.title = element_text(size = 13, color = "black", face = "bold"),
      legend.text = element_text(size = 13, color = "black", face = "bold"),
      axis.text.x = element_text(size = 13, color = "black", face = "bold"),
      axis.text.y = element_text(size = 13, color = "black", face = "bold"),
      axis.title.x = element_text(size = 13, color = "black", face = "bold"),
      axis.title.y = element_text(size = 13, color = "black", face = "bold"))

输出:

enter image description here

相关问题