How to move risk table within survminer plot across Y and X acess?

42 views Asked by At

When plotting risk tables within a Kaplan-Meier plot using risk.table.pos = "in", you might encounter issues with the alignment of the risk table. Even after turning off percentages with "fun = "pct", it can still appear misaligned. If you've set Y limits and the table disappears or if risk.table.height doesn't seem to work, you can try adjusting the position of the risk table along the Y and X axes.

Since my data doesn't reach the median, I want help to move the risk table up the Y axis and accordingly with the x axis: enter image description here

This is how to reproduce the plot:

library(survival)
library(survminer)

lung %>%  
  mutate(time=time/60) %>% 
  ggsurvplot(survfit(Surv(time,status) ~ sex, .), .,
                      pval = TRUE, pval.coord = c(0,.70),
                      risk.table = TRUE, 
risk.table.y.text = FALSE,
                      risk.table.pos = "in",
                      conf.int = T,
                      legend = "top",
                      risk.table.title="At risk",
                      risk.table.height=2,
                      legend.title = "Overall Survival",
                      legend.labs = c("Male","Female"),
                      xlab="Years",
                      break.x.by=1,
                       xlim = c(-.2, 3.1),
                      # ylim = c(.50,1),
                      censor=F,
)
0

There are 0 answers