Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Change risk.table.title font size in ggsurvplot

I do not know how to change the size of the title of my risk table, risk.table.title = "RISK"

Data:

library(survival)

data <- data.frame(time  =c(1,2,3,4),
                    status=rep(c(1,0),4),
                    n=c(1,2,3,4),
                   grp = c(1,1,0,0))
obj  <- Surv(time = data$time, event=data$status) 
fit <- survfit(obj ~ grp, data = data)

Now I fit the Kaplan-Meier curve:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

myplot <- ggsurvplot(
  fit,
  data = data,
  xlim = c(0, 60),
  break.x.by = 20,
  xlab = "Day",
  ylab = c("Survival probability"),
  risk.table = "abs_pct",
  font.x = c(12, face = "bold"),
  font.y = c(12, face = "bold"),
  font.tickslab = c(12),
  font.legend = c(12),
  risk.table.title = "RISK", 
  risk.table.col = "black",
  size = 1
)

How to do this?

>Solution :

You can set and adjust the theme used for the risk table via the tables.theme= argument. To change the size of the title font you could do:

library(survminer)

ggsurvplot(
  fit,
  data = data,
  xlim = c(0, 60),
  break.x.by = 20,
  xlab = "Day",
  ylab = c("Survival probability"),
  risk.table = "abs_pct",
  font.x = c(12, face = "bold"),
  font.y = c(12, face = "bold"),
  font.tickslab = c(12),
  font.legend = c(12),
  risk.table.title = "RISK",
  risk.table.col = "black",
  size = 1,
  tables.theme = theme_survminer() + 
    theme(plot.title = element_text(size = 40))
)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading