简体   繁体   中英

Changing the shape of Censored Events using the survminer package (ggsurvplot) in R

i'm using the survminer package to create a Kaplan-Meier-Curve in R, which is working pretty well:

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"))

Kaplan Meier Curve created with the Cod above

I would like to change the "+" as censored event and use an simple "|" instead. Unfortunately neither help(ggsurvplot) nor google could help me.


These are the loaded packeges:

    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

A minimal working example is the following:

library(survminer)
library(survival)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
p1 <- ggsurvplot(fit, data = lung)

Ideally, one would like to change the shape of the censors eg like so:

p2 <- ggsurvplot(fit, data = lung, censor.shape=124)

I have found no way to do this with the original survminer package. In a fork of survminer , I have implemented this behaviour, so that the following plot is produced:

在此处输入图片说明

Acceptable values for censor.shape can be found here: http://sape.inf.usi.ch/quick-reference/ggplot2/shape

I haven't tested this thoroughly, but this extension is already very useful for me. The "+" censors have bothered me for some time...

Edit: This suggestion was now merged, the development version of ggsurvplot now accepts censor.shape and censor.size arguments:

ggsurvplot(fit, data = lung, censor.shape="|", censor.size = 4)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM