ggsurvplot - 调整地层指标的厚度

问题描述 投票:0回答:1

是否可以调整地层指示器的厚度?
图例中的指标没有风险表中的那么粗。

library(survminer)
library(survival)

fit <- survfit(Surv(time, status) ~ sex, data = lung)

p <- ggsurvplot(
  fit,
  size = 1,
  legend.labs = c("A", "B"),
  linetype = "solid",
  break.time.by = 365,
  palette = c("#E7B800", "#2E9FDF"),
  risk.table = TRUE,
  censor = FALSE,
  risk.table.title = "No. at risk",
  tables.y.text = FALSE,
  legend.title = "",
  tables.theme = theme_cleantable() +
    theme(plot.title = element_text(size = 20))
)
p

红色箭头表示线条粗细的差异。

enter image description here

我尝试调整,但我不知道如何找出哪个参数与指标相关。如果有的话。

  tables.theme = theme_cleantable() +
    theme(plot.title = element_text(size = 20),
          strata.line.x = element_line(size = 5.5))
r ggplot2 survminer
1个回答
0
投票

风险表中 y 轴 (

tables.y.text
) 上显示的文本默认为 TRUE。如果将其更改为 FALSE,您将得到一条粗线。这是使用 ggtext 包中的
element_markdown
在内部实现的。实际功能是
.set_large_dash_as_ytext
.

我同意它比应有的厚。但是,您可以将其更改为使用 thinner 破折号以及小 em 破折号的 unicode 值 (\ufe58):

p$table <- p$table + 
  scale_y_discrete(labels=rep("\ufe58", 2)) +
  theme(plot.margin = margin(0, 0, 0, 0, "cm")); p

enter image description here


链接到 unicode 值列表

© www.soinside.com 2019 - 2024. All rights reserved.