Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for gt_tbl objects #203

Open
MokeEire opened this issue Aug 14, 2020 · 4 comments
Open

Support for gt_tbl objects #203

MokeEire opened this issue Aug 14, 2020 · 4 comments
Labels
feature a feature request or enhancement

Comments

@MokeEire
Copy link

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

gt_patch, used custom theming

@thomasp85
Copy link
Owner

Yes, that is the plan. Waiting for gt to get a grob conversion

@bwiernik
Copy link
Contributor

bwiernik commented Nov 5, 2020

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

@thomasp85
Copy link
Owner

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 :-)

@bwiernik
Copy link
Contributor

bwiernik commented Nov 5, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants