I would like to make a gg survplot with ggplot in R, I succeeded to make such a survplot but I am wondering how to change the x-axis title and x-axis interval.
ggsurvplot(sfit, conf.int=TRUE, pval=TRUE, risk.table=TRUE,
legend.labs=c("Set1", "Set2"), legend.title="Sets",
title="Curve with information about quitting")
I want to place ‘Time until quitting’ on the x-axis and have a difference of 50 between the intervals.
You can create a palette of your own and add it using the palette = argument. In the example below, mypalette is a vector of the nine colors in RColorBrewer's "Blues" palette. Then, specify which shades you want in the function argument. In this case, I chose shades 6 and 8. If not specified, the first two are chosen.
mypalette = RColorBrewer::brewer.pal(n = 9, name = 'Blues')
ggsurvplot(sfit,
conf.int=TRUE,
pval=TRUE,
risk.table=TRUE,
legend.labs=c("Set1", "Set2"),
legend.title="Sets",
title="Curve with information about quitting",
xlab = 'Time until quitting',
break.x.by = 50,
palette = mypalette[c(6,8)]
)