braincell.vis.plot_point_topology#
- braincell.vis.plot_point_topology(node_tree, *, preset='dendrotweaks', layout=None, layout_scale=1.0, highlight_point_ids=None, highlight_fractions=None, coverage_mode='fraction', highlight_color='#ef4444', color_mode=None, values=None, cmap=None, vmin=None, vmax=None, norm=None, value_label=None, value_unit_label=None, show_colorbar=True, node_color=None, edge_color=None, root_color=None, ax=None)[source]#
Render a
NodeTreeas a topology-only graph.- Parameters:
node_tree (
NodeTree) – Declaration-time node tree to render.preset (
str) – Name of the built-in style preset. Presets bundle default layout and colour settings.layout (
str|None) – Explicit layout algorithm override. WhenNone, uses the layout implied bypreset.layout_scale (
float) – Global spacing multiplier for the resolved layout. This scales the full node layout; it does not alter pairwise target distances.highlight_point_ids (iterable of int or None, optional) – Point ids to highlight. Highlight mode is mutually exclusive with
valuesmode in v1.highlight_fractions (
dict[int,float] |None) – Per-node highlight fractions in[0, 1]. When supplied, coverage-style colouring is used instead of discrete point-id highlighting.coverage_mode (
Literal['fraction','any','all']) – Interpretation ofhighlight_fractions.highlight_color (
str) – Colour used for highlighted points.color_mode (
Literal['solid','depth','values'] |None) – Node colouring mode.Nonemeans “infer from values or preset”.values (array-like or Quantity, optional) – Per-point scalar values for value colouring.
cmap (
str|None) – Matplotlib colormap name used in value mode.vmin (
float|None) – Explicit lower and upper bounds for the value colormap.vmax (
float|None) – Explicit lower and upper bounds for the value colormap.norm (matplotlib.colors.Normalize or None, optional) – Explicit normalization object for value mode.
value_unit_label (
str|None) – Explicit unit label appended to the colorbar label.show_colorbar (
bool) – IfTrue(default), draw a colorbar in value mode.ax (matplotlib.axes.Axes or None, optional) – Destination axes. When
None, a fresh figure and axes are created.
- Returns:
The rendered Matplotlib axes.
- Return type:
- Raises:
TypeError – If
node_treeis not aNodeTree.ValueError – If the node tree is empty, the layout is invalid, the layout scale is invalid, or highlight mode is combined with value mode.
Notes
Supported layouts in the current wrapper are
"twopi","dot","neato", and"kamada_kawai". Graphviz-backed layouts fall back to"kamada_kawai"with a warning when Graphviz is unavailable.Examples
Render with the default preset:
>>> ax = plot_point_topology(node_tree)
Render with explicit value colouring:
>>> ax = plot_point_topology( ... node_tree, ... values=point_values, ... cmap="plasma", ... value_label="Voltage", ... )