【问题标题】:Removing percent sign in ggsurvplot R删除 ggsurvplot R 中的百分号
【发布时间】:2020-08-16 02:44:47
【问题描述】:

我有以下代码,我正在用百分比而不是比例构建生存曲线。我也将生存时间缩短了数十倍。我想从下图中删除百分比符号,因为我想将其添加到图的 ylab 标题中。

library(survival)
library(survminer)
data(lung)
fit <- survfit(Surv(time, status) ~sex, data = lung)
ggsurvplot(fit, risk.table = TRUE, axes.offset = FALSE,
           break.y = 0.10,
           surv.scale = c("percent"),
           xlim = c(0, 1050))

【问题讨论】:

  • 为什么不plot(fit, col=2:3, xlab="t", ylab="prob.")
  • 您在寻找surv.scale = "default", 吗?
  • 默认选项显示比例。我的意思是没有百分比符号的百分比。

标签: r survival-analysis survival


【解决方案1】:

一种方法是制作绘图,然后添加一个 scale_y_continuous 调用,用你想要的任何东西替换 y 轴。

plot <- ggsurvplot(fit, risk.table = TRUE, axes.offset = FALSE,
           xlim = c(0, 1050),
           ylab = "Survival Probability (%)")
plot$plot <- plot$plot + 
  scale_y_continuous(breaks = seq(0,1,by=0.1), labels = seq(0,100,by=10))
plot

为什么包的维护者不让你直接用+ 做这个?

【讨论】:

    猜你喜欢
    • 2019-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-25
    • 2011-10-21
    • 2021-01-12
    相关资源
    最近更新 更多