llsabang
llsabang

Reputation: 155

Changing line size ggsurvplot

Does anyone know how to change line thickness in R's ggsurvplot? I have tried several things, including using size (below), but nothing works. The lines stay intractably thick in my output and exported graphs.

The code I have thus far is very basic:

library(survminer)
fit <- survfit(Surv(Time, Outcome) ~ Predictor, Confounder, data = Mydata)
ggsurvplot(fit, size = 0.2, data = Mydata) 

I appreciate any help!

Upvotes: 1

Views: 9932

Answers (2)

s.stats
s.stats

Reputation: 136

I know this has been a while but I had a similar issue and found that changing censor.size (which is the size of the censoring indicator) seemed to work. This can happen when there's lots of censoring, obscuring the line itself:

library(survminer)
fit <- survfit(Surv(Time, Outcome) ~ Predictor, Confounder, data = Mydata)
ggsurvplot(fit, censor.size=0.1, size = 0.2, data = Mydata)  ## Alt. set censor=FALSE

Upvotes: 3

Maurits Evers
Maurits Evers

Reputation: 50738

I can't confirm your issue. The size argument inside ggsurvplot works just fine:

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

enter image description here

This is with survival_2.42-6 and survminer_0.4.3.

Upvotes: 1

Related Questions