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)
CodePudding user response:
These are censoring events and it is normally expected that you show them on a survival curve. If you really want to get rid of them (and I don't see an option to do this directly within ggsurvplot
), you can remove the layer they are in after the plot is created. Here's a reprex:
library(survminer)
library(survival)
fit <- survfit( Surv(time, status) ~ sex, data = colon )
g <- ggsurvplot(fit, colon, palette = "jco", pval = TRUE)
g$plot$layers[[3]] <- NULL
g
If you search the help of ggsurvplot
, you will find there are more parameters to customize the censored events:
Censor points
censor: logical value. If TRUE (default), censors will be drawn.
censor.shape: character or numeric value specifying the point shape of censors. Default value is " " (3), a sensible choice is "|" (124).
censor.size: numeric value specifying the point size of censors. Default is 4.5.