gratia icon indicating copy to clipboard operation
gratia copied to clipboard

Add option for draw.gam() to return a list of plots instead of cowplot::plot_grid() output

Open ha0ye opened this issue 5 years ago • 3 comments

Since draw.gam() returns the output of cowplot::plot_grid(), it can be difficult to modify the properties of individual panels. It can be convenient to users to have the option to modify those individual panels and then call plot_grid themselves.

Maybe some kind of optional argument for whether to join the panels together?

draw.gam(..., assemble = TRUE) # returns plot_grid output as currently
draw.gam(..., assemble = FALSE) # returns the list of plots in `g`.

ha0ye avatar Feb 27 '19 15:02 ha0ye

Would it be better to have draw.gam() return inconsistently along the lines you suggest, or have a separate function assemble() which would produce (the equivalent of) g, and leave draw.gam() as it is now, but use assemble() internally to create g?

gavinsimpson avatar Feb 27 '19 15:02 gavinsimpson

Honestly, I'm unsure. A separate function maintains better {function name} -> {actual effect} mapping, but it's more memory load for users. Though, since you don't have an intro vignette yet, you have more flexibility to explicitly document the suggested workflow.

Ideally, we should just extend the + operator to work on the output of plot_grid... but that is a job for Claus Wilke, I think!

ha0ye avatar Feb 27 '19 16:02 ha0ye

OK, thanks @ha0ye. I'll make an executive decision then :smile:

gavinsimpson avatar Feb 27 '19 16:02 gavinsimpson