patchwork
patchwork copied to clipboard
Support for gt_tbl objects
Are there any plans to support gt_tbl
objects from {gt}?
Ideally this would look like:
library(tidyverse)
library(patchwork)
library(gt)
# simple table
mt_tab = gt(mtcars)
# simple scatterplot
mt_plot = ggplot(mtcars, aes(x = mpg, y = hp, colour = cyl))+
geom_point()
# using wrap elements because this seems to be the answer to non-ggplot grobs e.g. #164
wrap_elements(full = mt_tab | mt_plot)
Potential output
Yes, that is the plan. Waiting for gt to get a grob conversion
One thing that would be amazing with patchworks of gt abd ggplot grobs is if the rows of the table could be aligned with factors on the y axis of the plot. I'm mainly thinking of this for meta-analysis forest plots, which usually include a table of stats for each study alongside https://en.wikipedia.org/wiki/Forest_plot
I think that would potentially be too involved - I try to stay clear of adding a bunch of special alignment features for specific elements in some plots, as it would deteriorate the code in a few seconds :-)
Potentially at least getting the bottom of the header to line up with the top of the plot area and and the last row to line up with the bottom of the plot area might be enough m if that were easier