I have a graph with a legend that contains both color and line type elements, which represent neighborhood SES and sex, respectively. I'd like to rename the title of the line type element in the legend from "SexF" to "Sex". I've tried changing the legend.title =
line in the following code to legend.title = c("Neighborhood SES", "Sex")
, but the result is the same as the output below.
surv.model <- surv_df %>%
ggsurvplot_df(
surv.geom = geom_line,
color = "exposure",
linetype = "SexF",
censor = FALSE,
conf.int = FALSE,
ylim = c(crop, 1),
legend.title = "Neighborhood SES",
title = "Effect of Neighborhood SES on Survival",
xlab = "Time post-discharge (years)",
ylab = "Survival Probability",
surv.scale = "percent",
break.time.by = 2,
palette = c("#FFE082", "#FFB300", "#FF8F00", "#EF5350", "#B71C1C"),
ggtheme = theme_classic(),
) +
theme(
title = element_text(family = "proxima", face = "bold", size = 20),
legend.title = element_text(family = "proxima", face = "bold", size = 8),
legend.text = element_text(family = "proxima", size = 7),
legend.position = c(0.125, 0.325),
axis.title = element_text(family = "proxima", face = "bold", size = 12),
axis.text = element_text(family = "proxima", size = 10),
text = element_text(family = "proxima")
)