Skip to main content

Module figure

Module figure 

Source
Expand description

Figures (feature figure): each one drawn once as SVG, written as a vector PDF and a PNG by save, returned as PNG bytes by png for an agent, and shown as an image inside the full-screen views where the terminal has an image protocol (term, feature tui). What is saved is what was on screen.

The drawing is faba’s (src/figure/): a Canvas in points on white, greys for context and one accent for what a threshold removes. Panels here read values on an Axis (linear, or log on ln(shift + x)), the axis the printed histograms and the views’ histograms bin on too.

Text is set in the system’s Helvetica, Arial or DejaVu Sans; a host with none of them installed writes figures without their labels.

Re-exports§

pub use crate::qc::axis::Axis;

Modules§

qc
The cell QC figure: for each rule, the histogram of its metric in three layers (every cell, the cells passing the other rules, the cells only it removes) with its edge; total counts against detected genes, coloured by the mito fraction with removed cells ringed; cells per gene with the gene rule; and the removed cells by the rules they fail. The view draws the same panels (panel) as images.
stat
The statistics figure: the histogram of each of nnz, sum, mean and sd over the rows or the columns, and mean against sd with the Poisson line sd = √mean. Marked entries are drawn in the accent on every panel; the entry under the explorer’s cursor gets a pointer.
term
Figures drawn as images inside the full-screen views, in terminals that speak an image protocol (kitty, iTerm2, WezTerm, Ghostty, sixel). The image is the same SVG a save writes, rasterised to the area’s pixel size; elsewhere the views keep their text plots, which beat half-block images. From faba’s src/figure/term.rs.

Structs§

Canvas
An SVG drawing in points, white background.
Hist
A histogram of values in layers drawn back to front, each the values its mask takes (all of them for None) in its colour; with an edge, a dashed line and its label; with a cursor, a pointer under the axis.
Point
One point of a Scatter: where, its fill, and whether it is ringed.
Scatter
Points over two axes, with an edge on either; past Scatter::DOTS points, a density grid in grey with the ringed points’ cells over it in the accent.

Enums§

Anchor

Constants§

ACCENT
The one accent, as on screen: what a threshold removes, the cursor.
BAR
Bars.
FAINT
Bars behind a front subset.
GRID
Gridlines.
INK
Text and axes.
MUTED
Secondary text and axis labels.

Functions§

bins_for
Bins across a panel: about one per 6 points, from 20 to 60.
esc
Escape text for SVG content and attributes.
free_name
name, or failing that the first of {name}_2, {name}_3, … that no save would replace a file under.
image
svg as an RGBA image, scale pixels per point.
plot_area
The box a panel draws its data in, inside (x, y, w, h): room on the left for y labels, above for the title and subtitle, below for ticks and the x title.
png
svg as a PNG, scale pixels per point.
ramp
The light-to-dark ramp a value from 0 to 1 takes, in five steps.
save
Write svg under name (see saved_paths); the paths written. A file already there is never replaced: the save is refused instead.
saved_paths
The files a figure saved under name is written as: name itself when it ends in .pdf, .png or .svg, else name.pdf and name.png.
short
A number as a short label: 1.2k, 35, 0.05.
taken
Whether a save under name would replace a file already there.
text_width
About how wide s sets at size points, for laying out legends.