R survminer package ggsurvplot function cuts off at risk counts inside plot

Viewed 15

I'm trying to create a Kaplan-Meier plot using ggsurvplot. I want the at risk counts to show up inside the plot. When I do this, the risk table title and risk counts overlap one another and the risk counts get cut off by the x-axis. Does anyone know how to solve this? I've tried to edit the risk.table.height but that doesn't seem to do anything when the risk table is inside the plot. It seems the adjustments I make to the table and plot themes might be the problem but I'm not sure.

ggsurvplot(os, size = 2, censor.size=9,conf.int=F,palette = c("blue"), 
    risk.table=T, risk.table.title='At risk', risk.table.pos=c("in"),
    risk.table.col="strata",risk.table.fontsize=10, legend="none",
    title="Overall survival",font.tickslab = c(20, "plain", "black"),
    xlab="Months after registration", ylab="Survival probability", 
    font.x = c(size=25, face="plain"), font.y=c(size=25, face="plain"),
    surv.scale="percent", break.x.by=12,
    xlim=c(0,60), break.y.by=.20)

surv_plot$table <- surv_plot$table +
  theme(plot.title = element_text(size=25, color="black"))

surv_plot$plot <- surv_plot$plot +
  theme(
    plot.title = element_text(hjust=0.5, size=30, face="bold"),
    axis.line = element_line(colour = 'black', size = 1.5),
    axis.ticks = element_line(colour = "black", size = 1.5),
    axis.ticks.length = unit(7, "pt"))

surv_plot

KM plot

0 Answers
Related