openpharma / visR

A package to wrap functionality for plots, tables and diagrams adhering to graphical principles.
https://openpharma.github.io/visR/
Other
179 stars 31 forks source link

Combined KM Plot and tables for faceting #14

Closed cschaerfe closed 4 years ago

cschaerfe commented 4 years ago

When stratifying, it is sometimes useful to use ggplot's faceting (facet_grid and facet_wrap) However, this only works (if at all) only for the KM plot (e.g., when using survminer, but also visR), but it would be really useful to also have the risk table for each facet. Maybe this is something we could implement in the future?

github-actions[bot] commented 4 years ago

Stale issue message

SHAESEN2 commented 4 years ago

Did you look at the Survminer examples?

g2 <- ggplotGrob(curv_facet) g3 <- ggplotGrob(tbl_facet) min_ncol <- min(ncol(g2), ncol(g3)) g <- gridExtra::gtable_rbind(g2[, 1:min_ncol], g3[, 1:min_ncol], size="last") g$widths <- grid::unit.pmax(g2$widths, g3$widths) grid::grid.newpage() grid::grid.draw(g)

Note that one typo was present in the original code.