plotnine.composition.plot_layout

plot_layout(
    *,
    nrow=None,
    ncol=None,
    byrow=None,
    widths=None,
    heights=None,
    design=None,
    guides=None
)

Customise the layout of plots in a composition

Parameter Attributes

nrow: int | None = None

Number of rows

ncol: int | None = None

Number of columns

byrow: bool | None = None

How to place plots into the grid. If None or True, they are placed row by row, left to right. If False, they are placed column by column, top to bottom.

widths: Sequence[float] | None = None

Relative widths of each column

heights: Sequence[float] | None = None

Relative heights of each column

design: str | None = None

Text-grid layout specification

Each line is one row of the grid; each character is one cell. Use #, ., or a space for empty cells; use any other character to label a region. Cells with the same label form a rectangular area that hosts one composition item.

Areas are assigned to items in the sorted order of the label characters: the lexicographically first label gets the first composition item. Cannot be combined with nrow or ncol. byrow is silently ignored.

Example::

design = """
    #33#
    #2#4
    11#4
"""
guides: GuidesMode | None = None

How to handle guides in this composition.

  • "collect": dedupe and render guides from descendants once at this level.
  • "keep": block any ancestor’s collect from reaching this subtree.
  • None (default): neither collect nor block — propagate any ancestor’s setting through unchanged.

Methods

Name Description
update Update this layout with the contents of other

update

update(other)

Update this layout with the contents of other