gpt4 book ai didi

r - 更改survminer中标题 "number at risk"的大小

转载 作者:行者123 更新时间:2023-12-03 09:07:09 30 4
gpt4 key购买 nike

我正在使用 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))

最佳答案

更改默认主题。默认主题是 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)

enter image description here

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

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

enter image description here

关于r - 更改survminer中标题 "number at risk"的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46354301/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com