lib module

render function

#let render(
  cell,
  projection: "xy",
  color-by: "type",
  colormap: "viridis",
  minimum: none,
  maximum: none,
  width: 120mm,
  height: 90mm,
  canvas-width: 800,
  canvas-height: 600,
  padding: 24,
  geometry: "tapered",
  radius-mode: "readable",
  soma-mode: "equivalent-sphere",
  stroke-width: 2,
  minimum-radius: 1,
  maximum-radius: 18,
  maximum-soma-radius: 96,
  radius-scale: 1,
  radius-exponent: 0.5,
  soma-scale: 1,
  background: none,
  outline-color: none,
  outline-width: 1,
  display-tolerance: none,
  include-nodes: false,
  anchor-nodes: (),
  labels: (),
  markers: (),
  cetz: none,
  cetz-labels: (),
  legend: none,
  color-bar: none,
  scale-bar: none,
  strict-node-ids: true,
  return-report: false,
)

Documentation

Render a radius-aware morphology as one WASM-generated SVG, then add labels and a scale bar as native Typst content. width and height are page units; all canvas and morphology values are unitless numbers.

Parameters

  • cell (dictionary): The morphology to render.
  • projection (str, dictionary): Named or custom orthographic projection. Default: "xy".
  • color-by (str, dictionary): Compartment coloring, a uniform color, or scalar node data. Default: "type".
  • colormap (str): Named scalar palette, either "viridis" or "magma". Default: "viridis".
  • minimum (none, int, float): Optional lower bound for scalar coloring. Default: none.
  • maximum (none, int, float): Optional upper bound for scalar coloring. Default: none.
  • width (length): Positive Typst width of the render block. Default: 120mm.
  • height (length): Positive Typst height of the render block. Default: 90mm.
  • canvas-width (int): Positive SVG viewport width in unitless pixels. Default: 800.
  • canvas-height (int): Positive SVG viewport height in unitless pixels. Default: 600.
  • padding (int, float): Non-negative SVG viewport padding. Default: 24.
  • geometry (str): Segment geometry mode, such as "tapered" or "skeleton". Default: "tapered".
  • radius-mode (str): Radius display policy applied to neurites. Default: "readable".
  • soma-mode (str): Soma display policy. Default: "equivalent-sphere".
  • stroke-width (int, float): Skeleton or centerline width in SVG pixels. Default: 2.
  • minimum-radius (int, float): Lower display-radius clamp in SVG pixels. Default: 1.
  • maximum-radius (int, float): Upper neurite display-radius clamp in SVG pixels. Default: 18.
  • maximum-soma-radius (int, float): Upper soma display-radius clamp in SVG pixels. Default: 96.
  • radius-scale (int, float): Positive multiplier applied to neurite radii. Default: 1.
  • radius-exponent (int, float): Positive exponent applied to neurite radii. Default: 0.5.
  • soma-scale (int, float): Positive multiplier applied to soma radii. Default: 1.
  • background (none, str): Optional SVG background color. Default: none.
  • outline-color (none, str): Optional segment-outline color. Default: none.
  • outline-width (int, float): Non-negative segment-outline width in SVG pixels. Default: 1.
  • display-tolerance (none, int, float): Optional display-only simplification tolerance in cell.units. Default: none.
  • include-nodes (bool): Whether the generated SVG should include node elements. Default: false.
  • anchor-nodes (array): Additional integer node IDs whose projected positions are returned. Default: ().
  • labels (array): Typst-native annotations returned by label. Default: ().
  • markers (array): Typst-native annotations returned by marker. Default: ().
  • cetz (none, module): Imported CeTZ module required by cetz-labels. Default: none.
  • cetz-labels (array): Leader annotations returned by cetz-label. Default: ().
  • legend (none, dictionary): Optional categorical legend returned by legend. Default: none.
  • color-bar (none, dictionary): Optional scalar color bar returned by color-bar. Default: none.
  • scale-bar (none, dictionary): Optional physical scale bar returned by scale-bar. Default: none.
  • strict-node-ids (bool): Whether missing annotation and anchor node IDs should stop evaluation. Default: true.
  • return-report (bool): Whether to return geometry metadata with the rendered content. Default: false.

Returns

content, dictionary

Defined in lib.typ:883.

Source

Module
lib
Defined in
lib.typ:883
Source
View source