[英]issues using survminer::ggsurvplot to plot many survival curves programmatically in r
[英]Changing the shape of Censored Events using the survminer package (ggsurvplot) in R
我正在使用survminer软件包在R中创建Kaplan-Meier-Curve,效果很好:
plotUICC=survfit(Surv(as.numeric(myData$eventtime),event=myData$eventtype)~myData$UICC, data = myData)
ggsurvplot(plotUICC,data=myData, risk.table = FALSE,pval = TRUE,conf.int = FALSE,legend.labs = c("UICC I", "UICC II"),legend = c(0.25, 0.26),legend.title = "",xlab = "Time in Months"))
我想将“ +”更改为受检查事件,并使用简单的“ |” 代替。 不幸的是,help(ggsurvplot)和Google都无法帮助我。
这些是已加载的软件包:
other attached packages:
[1] ggthemes_3.4.0 survminer_0.3.1 ggpubr_0.1.2 ggplot2_2.2.1 survival_2.40-1
[6] readxl_0.1.1 gridExtra_2.2.1
下面是一个最小的工作示例:
library(survminer)
library(survival)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
p1 <- ggsurvplot(fit, data = lung)
理想情况下,您希望更改检查器的形状,例如:
p2 <- ggsurvplot(fit, data = lung, censor.shape=124)
我没有办法用原始的survminer软件包来做到这一点。 在survminer的分支中,我实现了此行为,因此产生了以下图:
可以在此处找到censor.shape的可接受值: http ://sape.inf.usi.ch/quick-reference/ggplot2/shape
我尚未对此进行全面测试,但是此扩展名对我已经非常有用。 “ +”审查员困扰了我一段时间。
编辑:此建议现已合并,ggsurvplot的开发版本现在接受censor.shape和censor.size参数:
ggsurvplot(fit, data = lung, censor.shape="|", censor.size = 4)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.