thomasp85 / patchwork

The Composer of ggplots
https://patchwork.data-imaginist.com
Other
2.42k stars 157 forks source link

empty `patchwork` object #334

Closed rerickson-usgs closed 8 months ago

rerickson-usgs commented 9 months ago

I'm using a loop to go over data. How do I create an empty patchwork object

Let's say my loop looks like this:

df_save <- tibble()
for (idx in my_names){

    ## Do stuff ....
   out <- my_cool_function()

    df_save  <- df_save |> bind_rows(out)
} 

How would I do this with patchwork? I didn't find a way to create a patchwork object that I could add to in the documentation.

thomasp85 commented 8 months ago

I would generally store the plots you create in a list and use wrap_plots() to turn them into a patchwork