Advertisements
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:
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))
)