gggrid

fun gggrid(plots: Iterable<Figure?>, ncol: Int? = null, widths: List<Number>? = null, heights: List<Number>? = null, hspace: Number? = null, vspace: Number? = null, fit: Boolean = true, align: Boolean = false, sharex: Any? = null, sharey: Any? = null, guides: String? = null): SubPlotsFigure

Combines several plots on one figure, organized in a regular grid.

Examples

Return

SubPlotsFigure object.

Parameters

plots

Collection of plots. Use Null-value to fill-in empty cells in grid.

ncol

Number of columns in grid. If not specified, shows plots horizontally, in one row.

widths

Relative width of each column of grid, left to right.

heights

Relative height of each row of grid, top-down.

hspace

default = 4. Cell horizontal spacing in px.

vspace

default = 4. Cell vertical spacing in px.

fit

default = true. Whether to stretch each plot to match the aspect ratio of its cell (fit = true), or to preserve the original aspect ratio of plots (fit = false).

align

default = false. If true, align inner areas (i.e., "geom" bounds) of plots. However, cells containing other (sub)grids are not participating in the plot "inner areas" layouting.

sharex

String or Boolean Controls sharing of X-axis limits between subplots in the grid.

  • 'all'/True - share limits between all subplots.

  • 'none'/False - do not share limits between subplots.

  • 'row' - share limits between subplots in the same row.

  • 'col' - share limits between subplots in the same column.

sharey

String or Boolean Controls sharing of Y-axis limits between subplots in the grid.

  • 'all'/True - share limits between all subplots.

  • 'none'/False - do not share limits between subplots.

  • 'row' - share limits between subplots in the same row.

  • 'col' - share limits between subplots in the same column.

guides

String default = "auto" Specifies how guides (legends and colorbars) should be treated in the layout.

  • "collect" - collect guides from all subplots, removing duplicates.

  • "keep" - keep guides in their original subplots; do not collect at this level.

  • "auto" - allow guides to be collected if an upper-level layout uses guides = "collect"; otherwise, keep them in subplots.

Duplicates are identified by comparing visual properties:

  • For legends: title, labels, and all aesthetic values (colors, shapes, sizes, etc.).

  • For colorbars: title, domain limits, breaks, and color gradient.