djsir-data / djprtheme

ggplot2 theme package for the Victorian Department of Jobs, Precincts and Regions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve get_plot_data() for patchwork plots

MattCowgill opened this issue · comments

I want to be able to use get_plot_data() for patchwork plots, which are ggplots (or other grid objects). I have implemented a hacky and sub-optimal solution - for each subplot in the patchwork plot, we get the data using the existing method, then dplyr::bind_rows() all the data into one data frame. This is clumsy and ugly - I do not like the results.

An alternative would be to return a list of dataframes. Then, when saving in Shiny, it could either:

  • save each DF as a CSV, combine into one ZIP
  • save each DF as a worksheet in an Excel workbook (using openxlsx) rather than CSVs