Nanoplots

In-cell plots, drawn natively and scaled against one domain.

format-nanoplot and the three renderers Keisen ships: nanoplot-line, nanoplot-points, and nanoplot-bar.

A nanoplot cell holds an array of readings, and format-nanoplot draws it through the function given as plot. The domain spans every reading in the column, taken from the column itself, so the cells can be compared; that is the whole point, since sparklines scaled per cell say nothing. domain: (low, high) overrides it for a column read against a scale that is not its own.

Three renderers ship, each drawn with native Typst primitives and each usable as plot.

Nanoplot renderers
Function Notable arguments
nanoplot-line(numbers, ..) domain: none, width: 4em, height: 0.8em, stroke: auto, thickness: 0.6pt. A sparkline.
nanoplot-points(numbers, ..) The same, plus radius: 1pt. A sparkline with its readings marked.
nanoplot-bar(numbers, ..) domain: none, width: 4em, height: 0.8em, fill: auto, gap: 30%. Bars, measured from zero.

stroke: auto and fill: auto follow the surrounding text colour, so a plot in a styled cell is drawn in that cell’s ink. Bars are measured from zero rather than from the domain’s low, because a bar drawn from 5 to 10 makes a small difference look like the whole quantity; the line renderers scale to the domain instead, since a trend is about shape rather than magnitude.

A renderer is any (numbers, domain: none, width: .., height: ..) => content, so one written in a document works exactly as well as these.

Back to top