'ggsurvplot changing confidence interval line size

Trying to change the line size of my confidence interval using ggsurvplot. When I use change the size to 1 or 2, it only affects the size of the center line, and not the size of the confidence interval lines. Any suggestions on how to alter the size of those lines?

Here is my code:

ggsurvplot(ovlsfit,
                  surv.scale="percent",
                  title="Survival Curve",
                  xlim=c(-0.02,5.1),
                  xlab=c("Time (y)"),
                  break.x.by=1,
                  censor=FALSE,
                  axes.offset=FALSE,
                  conf.int.style=c("step"),
                  legend=c("none"),
                  linetype = "strata",
                  color="black",
                  size=0.8,
                  risk.table=TRUE,
                  risk.table.height=0.18,
                  risk.table.pos=c("out"),
                  risk.table.fontsize=4)

And output:

enter image description here



Solution 1:[1]

Let's create a model similar to yours for demonstration:

library(survival)
library(survminer)

ovlsfit <- survfit(Surv(time/660, status) ~ 1, data = colon)

Now we will try to recreate your plot:

p <- ggsurvplot(ovlsfit,
                surv.scale = "percent",
                title = "Survival Curve",
                xlim = c(-0.02,5.1),
                xlab = c("Time (y)"),
                break.x.by = 1,
                censor = FALSE,
                axes.offset = FALSE,
                conf.int.style = c("step"),
                legend = c("none"),
                linetype = 'strata',
                palette = "black",
                size = 0.8,
                risk.table = TRUE,
                risk.table.height = 0.18,
                risk.table.pos = c("out"),
                risk.table.fontsize = 4)

p

enter image description here

Unfortunately, there is no direct access to the confidence interval line size from within the call to ggsurvplot, but we can easily access the layers they are in and change the line size directly. Here, we will make them large for demonstration purposes:

p$plot$layers[[3]]$aes_params$size <- 2
p$plot$layers[[4]]$aes_params$size <- 2

p

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Allan Cameron