STHDA forum

survminer » [Solved] How to Change Text Font Family in ggsurvplot

Administrator

rank_admin.png

Avatar

Signed up since: 10/02/2013

Messages: 32

On 08/07/2017 at 10h45
To change the font family of theme element and text element in ggsurvplot() [survminer package], specify the arguments ggtheme and font.family as follow:

Code R :
 
library(survival)
library(survminer)
# Fit survival curves
fit<- survfit(Surv(time, status) ~ sex, data = lung)
# Visualize
ggsurvplot(fit, 
           risk.table = TRUE,          # Display risk table
           risk.table.pos = "in",      # Put risk table inside the main plot
           pval = TRUE,                # Show p-value
           ggtheme = theme_classic2(base_family = "Courier New"),
           font.family = "Courier New" # Risk table text element font family
           )
 


The output looks like this:

Website    
Answer
You aren't allowed to write in this category
1 User online : 0 Administrator, 0 Moderator, 0 Member and 1 Visitor
User online : No member online