Bine
April 27, 2023, 6:56am
1
Dear all,
I have been trying for a while now, but I cant figure this out.
I have created a ggsurvplot with
sfit <- survfit(Surv(survalltime, event_crc)~ajcc, data=pheno)
I then wanted to change the x-axis from days to years, which also worked with
ggsurvplot(sfit,xscale = "d_y")
However, I cant seem to figure out how I can limit it now to 5 years instead of currently 20 years in the x-axis.
I tried this:
ggsurvplot(sfit,xscale = "d_y",xlim=c(0,5))
But it doesnt work. Has anyone an idea?
Thanks so much!
Bine
DavoWW
April 29, 2023, 8:28am
2
Hi @Bine
You need to limit the x-axis on the old day scale, not the new year scale (the new scale is really only providing labels).
So, 5 years * 365 days = 1825.
Try:
ggsurvplot(sfit,xscale = "d_y",xlim=c(0,1825))
system
Closed
May 20, 2023, 8:28am
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.