wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
704 stars 84 forks source link

Add metadata to plot object #145

Open flying-sheep opened 5 years ago

flying-sheep commented 5 years ago

It would be nice to be able to check programmatically if a given ggplot is a plot_grid and what layout it has.

As-is, you basically have to try if any of the elements is a GeomDrawGrob and then painstakingly reassemble the layout from geom_params$xmin/xmax/....

This would be useful to write an alternative to save_plot that infers the number of rows/columns using abovementioned metadata or information from facets.