-
Notifications
You must be signed in to change notification settings - Fork 209
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
Allow for easy insertion of ggplot plots in a table column via a formatter #155
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in person, I think all such features shouldn't be specific to ggplot but should work with all static R plots.
* master: (37 commits) Use webshot to generate images of HTML tables (#257) Rewritten vignette for adding summary rows (#273) Move roxygen documentation to Markdown (#253) Store empty-string value in `sep` vector (#274) Bugfixes and improvements to `summary_rows()` (#175) Modify _travis.yml (#263) Make several refactoring improvements to some `format_*()` functions (#244) Include option to hide all column labels (#237) Refactoring of formatter functions (#232) Improvement to the handling of a `pattern` in most `fmt*()` functions (#95) pkgdown cleanup (#226) Make argument names in `tab_options()` more consistent with terminology (#221) dplyr::data_frame deprecated (#195) Remove a unicode character from roxygen documentation (#220) Try again, this time with `travis encrypt --com` Trying again with github token (#223) Use jcheng5 GitHub PAT instead of rich-iannone (#222) Update README (#219) Fix for `fmt_date()` that allows `Date` columns to work (#203) Remove check on macOS ...
@rich-iannone any update on this? embedded plots came up again for me today, and I'm getting by with a rebased version of this branch... can I help at all? |
Hey! Any updates to this? I need to embed box plots in a table and would love to use this function. Thanks! |
It would be nice if this could be pushed. I think 90%+ of the use would be for ggplot, and it works well for that. |
The new
fmt_ggplot()
function allows for easier inclusion of ggplot2 plots (within a list column of the input table data) into a gt table. The common pattern toward obtaining these plots is throughmutation of a list column containing all the
data
required for plot:While the PR contains functionality to detect and automatically format columns containing ggplot2 plots, we can also opt to use the
fmt_ggplot()
function to allow us to specifyrows
and set options for the plots'height
andaspect_ratio
.Here are some examples of how this would work:
Here are images of
tab_1
andtab_2
:These are minimal examples showing the basic usage of inserting plots, so, the resulting tables look less than ideal. With some extra care given to setting common axis ranges and using
ggplot2::theme()
to increase font sizes, line widths, etc., inserted plots would become more aesthetically pleasing.Fixes #152