0

I have made some nice survival plots with risk tables (sequence and histology) using using the survminer library.

The data is at https://drive.google.com/file/d/1Svtmyj9w968toggDshLg9eYex9N_fws5/view?usp=share_link

The data is at https://drive.google.com/file/d/1LZmQDFXSv8drJHBC2lS1av7TEIPva5Z9/view?usp=share_link

library(ggplot2)
library(ggpubr)
library(survminer)

sequence=readRDS("sequence.rds")

histology=readRDS("histology.rds")


sequence
histology

sequence

histology

I can combined the plots (without the risk tables) using ggarrage

combined_works<-ggarrange(sequence$plot, histology$plot,
          labels = c("A", "B"),
          font.label = list(size = 24),
          ncol = 2, nrow = 1)

combined_works

combined_works

But i can't get them to combine with the risk tables

combined_doesnt_work<-ggarrange(sequence, histology,
          labels = c("A", "B"),
          font.label = list(size = 24),
          ncol = 2, nrow = 1)

combined_doesnt_work

I have come to understand the output of ggsurvplot is a list, which includes both the plots and the tables. And that ggarrange wants grobs. Is there way to combine the plot and table elements together into a grob which ggarange will let me combine?

Joe Erinjeri
  • 1,200
  • 1
  • 7
  • 15

1 Answers1

0

Thanks to Emily Zabor for help with generating the following solution.

arrange_ggsurvplots(list(sequence, histology), print = TRUE, ncol = 2, nrow = 1, risk.table.height = 0.2)

enter image description here

Joe Erinjeri
  • 1,200
  • 1
  • 7
  • 15