rsurvivalsurvminer

Remove dash on strata line when using ggsurvplot and survminer


How do I change the line type for the sex strata so that it is a line without all the small "crosses" as shows in the picture below? I hope to get just a solid line instead. The cross makes things look a little congested when there is a lot of data points.

library(survminer)


fit <- survfit( Surv(time, status) ~ sex, data = colon )
ggsurvplot(fit, colon,
                palette = "jco", pval = TRUE)

enter image description here


Solution

  • You just have to set censor=FALSE.

    library(survminer)
    library(survival) # to obtain the colon dataset
    
    fit <- survfit(Surv(time, status) ~ sex, data = colon)
    ggsurvplot(fit, colon, censor = FALSE,
               palette = "jco", pval = TRUE)
    
    

    survival_plot

    If you search the help of ggsurvplot, you will find there are more parameters to customize the censored events:

    Censor points