depictr.arrange_plots#

depictr.arrange_plots(*plots, ncol=None, nrow=None, title=None)#

Arrange several plots into one composed figure.

Builds a grid by joining plots side by side (plotnine’s |) into rows of ncol, then stacking the rows (/). The result is a plotnine composition, so it still has .draw and .save. This is the building block behind the multi-panel reports (for example depictr.diagnostics.residual_diagnostics_plot()).

Parameters:
  • *plots (plotnine.ggplot) – The plots to arrange. None entries are dropped.

  • ncol (int, optional) – The grid shape. Give one and the other is derived from the count; give neither and a sensible default is chosen (one column for a single plot, two up to four plots, three beyond).

  • nrow (int, optional) – The grid shape. Give one and the other is derived from the count; give neither and a sensible default is chosen (one column for a single plot, two up to four plots, three beyond).

  • title (str, optional) – A title. Applied only when a single plot is passed: plotnine compositions have no figure-level title, so a grid should carry a title on each panel instead.

Returns:

A single plot when one is passed, otherwise a composition.

Return type:

plotnine.ggplot or plotnine.composition.Compose