braincell.vis.plot_traces

Contents

braincell.vis.plot_traces#

braincell.vis.plot_traces(morpho, time, values_over_time, *, locset=None, labels=None, colors=None, cmap='tab10', layout=None, shape=None, time_unit_label=None, value_unit_label=None, figsize=None, sharex=True, show_morphology=True)[source]#

Plot time-series traces at selected morphology locations.

Parameters:
  • morpho (Morphology) – Source morphology. Used for both the left-hand morphology view (when show_morphology=True) and to validate that the number of traces matches the number of locset points.

  • time (ArrayLike) – 1-D array of timestamps with length T. Units are stripped via brainunit for plotting; if no unit is available the axis label is left blank unless time_unit_label is given.

  • values_over_time (ArrayLike) – (T, n_locations) matrix of trace samples. n_locations must equal either len(locset.points) (if locset is supplied) or the number of columns of the array (otherwise).

  • locset (LocsetMask | None) – Evaluated locset; each point becomes a marker on the morphology and a matching trace panel on the right.

  • labels (Sequence[str] | None) – Optional labels per trace. When None, panels are labelled Loc 0, Loc 1, ….

  • colors (Sequence | None) – Optional explicit per-trace colours (any matplotlib colour spec). When None, colours are drawn from cmap.

  • cmap (str) – Matplotlib colormap name used to auto-colour traces when colors is None.

  • layout (str | None) – Layout / shape parameters forwarded to plot2d() for the morphology panel.

  • shape (str | None) – Layout / shape parameters forwarded to plot2d() for the morphology panel.

  • time_unit_label (str | None) – Axis-label unit strings. These override any brainunit units attached to time / values_over_time.

  • value_unit_label (str | None) – Axis-label unit strings. These override any brainunit units attached to time / values_over_time.

  • figsize (tuple[float, float] | None) – Figure size. When None, defaults to (10, 2 * n_locations).

  • sharex (bool) – If True (default), all trace panels share the time axis.

  • show_morphology (bool) – If False, no morphology view is drawn and only the trace stack is returned.

Returns:

Figure, morphology axes (None when the view is hidden), and the tuple of trace axes.

Return type:

TracesResult

Raises:

ValueError – If the column count of values_over_time does not match the number of sampled locations.