Skip to content
layout

layout

Mojo module 🡭

layout

Cell layout: the one core render_facets() and render_grid() share.

A figure made of cells is one idea with two faces. render_facets() is the uniform one: n plots, cols per row, every cell the same size. render_grid() is the unequal one: each plot names a row, a column and optional spans, over tracks that can carry weights, so “a wide time series above two narrow detail panels” is expressible (#347).

Both come through _render_cells_generic(). A facet grid is the degenerate case – one cell per plot, equal weights – so there is one implementation of the hard parts: the shared y-domain, the gutter between stacked rows, and the six per-cell annotation passes.

One core rather than two is the whole point. A second cell loop written alongside the first is a subset of it by default: it renders the marks, which is the visible part, and quietly omits the parts nobody looked at yet. Vector output and per-cell annotations are both in that category, and neither absence would show up in a screenshot.

Insets are the other half of #347 and deliberately not cells. render_inset() draws a base plot and then a second plot inside a fractional sub-rect of the base’s plot rect, over it. An inset is an overlay, not a cell: it has no track, no weight and no neighbor, and folding it into the grid model would distort both. It shares nothing with the cell core beyond the two render helpers render() itself uses.

Structs

  • GridCell: Where one plot sits: a row and column, and how many of each it spans.
  • Figure: A composite chart – several Plots laid out in grid cells – that has not been rendered yet (#697).

Functions