I'm trying to combine multiple survival plots, using arrange_ggsurvplots
. Each plots was made by ggsurvplot
function. Most of them works well. However, it is difficult to combine legends.
let's take an example in survminer
packages.
https://rpkgs.datanovia.com/survminer/reference/arrange_ggsurvplots.html
# Fit survival curves
require("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)
# List of ggsurvplots
require("survminer")
splots <- list()
splots[[1]] <- ggsurvplot(fit, data = lung, risk.table = TRUE, ggtheme = theme_minimal())
splots[[2]] <- ggsurvplot(fit, data = lung, risk.table = TRUE, ggtheme = theme_grey())
# Arrange multiple ggsurvplots and print the output
arrange_ggsurvplots(splots, print = TRUE,
ncol = 2, nrow = 1, risk.table.height = 0.4)
As you can see, the legend was not combined. Each column has it own legend.
I want to combine it. However, common methods with cowplot
packages like ggarrange
function didn't worked. Is there a better solution for this?