I am looking to customise my ggsurvplot title by making one word in it be in italics. I have tried the more 'classic' code that words in ggplots, but they don't appear to work in this.
Here is an example of what I am doing:
library(survival)
library(survminer)
fit <- survfit(Surv(time, status) ~ sex, data = lung)
plt1 <- ggsurvplot(fit, data =lung, title = "Adding *italics* to the Title")
plt1
[plt1 ][1]
plt2 <- ggsurvplot(fit, data =lung, title = "Adding <i>italics</i> to the Title")
plt2
[plt2][1]
They then just copy the title directly as I have written it so no italics! D: Looking forward to any help I can get.
Thank you
CodePudding user response:
You can use an expression
like this:
ggsurvplot(fit, data =lung, title = expression(paste("Adding ", italic("italics"), " to a title")))