neu_draw.layout

Arranging a set of objects: boxes (BBox) in, offsets (Vec3) out. Knows nothing about drawables or renderers.

superimpose_offsets() sends every object’s anchor to one point; arrange_offsets() lays them out on a row or grid. Both act only on the axes asked for, so they compose without discarding coordinates that carry meaning, such as depth:

scene.superimpose(axes="z").arrange(along="x")

Spacing is either packed by each box’s real extent (spacing=None, the default) or a fixed pitch in nm, for figures where uneven spacing would look meaningful.

Attributes

Functions

anchor_point(box[, anchor]) → neu_lib.Vec3

The point of box a layout places.

arrange_offsets(boxes, *[, along, anchor, spacing, ...]) → list[neu_lib.Vec3]

Offsets laying the boxes out along along, wrapping to down every wrap.

axis_index(axis) → int

"x" or 2 to an index into a zyx triple.

superimpose_offsets(boxes, *[, anchor, axes, at]) → list[neu_lib.Vec3]

Offsets putting every box's anchor on the same point.

Module Contents

neu_draw.layout.anchor_point(box: neu_lib.BBox, anchor: str = 'center') → neu_lib.Vec3

The point of box a layout places.

neu_draw.layout.arrange_offsets(boxes: Sequence[neu_lib.BBox], *, along: Any = 'x', anchor: str = 'center', spacing: float | None = None, gap: float = DEFAULT_GAP, wrap: int | None = None, down: Any = 'z', origin: Any = None, align_cross: bool = True) → list[neu_lib.Vec3]

Offsets laying the boxes out along along, wrapping to down every wrap.

spacing is a fixed pitch in nm. Left None, the boxes are packed by their own extents with gap between them (a fraction of the mean extent), so unequal sizes do not overlap. wrap turns the row into a grid.

align_cross=True also lines the anchors up on the other axes, so a row reads as a row even for objects from different datasets; False leaves those axes untouched. origin is where the first anchor lands, by default where it already is.

neu_draw.layout.axis_index(axis: Any) → int

"x" or 2 to an index into a zyx triple.

neu_draw.layout.superimpose_offsets(boxes: Sequence[neu_lib.BBox], *, anchor: str = 'center', axes: Any = None, at: Any = None) → list[neu_lib.Vec3]

Offsets putting every box’s anchor on the same point.

The point is at, by default the first box’s anchor, so the first object stays put and the others move onto it. axes restricts which axes move: axes="z" aligns depth and leaves the rest where the data put them.

neu_draw.layout.ANCHORS = ('center', 'min', 'max')
neu_draw.layout.AXES
neu_draw.layout.DEFAULT_GAP = 0.1