我正在生成要在演示文稿中使用的生存曲线,理想情况下我想自定义 p 值文本的颜色。有可能这样做吗?我用示例数据做了一个例子,向你展示我到目前为止所做的事情。剩下的就是 #5A6469 的 p 值文本的颜色,但我已经尝试了几乎所有选项,并且它始终保持黑色!谢谢您的帮助。
library(tidyverse)
library(survival)
library(survminer)
# theme using custom colour palette and with transparent background because the slides are grey
theme_kcl <- theme_classic() + theme(plot.title = element_text(colour = "#0A2D50", size = 16, hjust = 0.5), axis.title = element_text(colour = "#0A2D50", size = 14), axis.title.x = element_text(margin = margin(t = 10, r = 0, b = 0, l = 0)), axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)), axis.text = element_text(colour = "#5A6469", size = 12), legend.text = element_text(colour = "#5A6469", size = 12)) + theme(axis.ticks.x = element_line(colour = "#5A6469"), axis.ticks.y = element_line(colour = "#5A6469"), axis.line = element_line(colour = "#0A2D50")) + theme(panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA), legend.background = element_rect(fill = "transparent", colour = NA))
# Fit example data
fit<- survfit(Surv(time, status) ~ sex, data = lung)
# Draw survival curves
ggsurvplot(fit, palette = c("#C83296", "#009EA0"), pval = TRUE, legend = c(0.84, 0.8), legend.title = "", ggtheme = theme_kcl)