spine.vis.cluster

Tools to draw voxelized data organized in clusts.

Functions

scatter_clusters(points, clusts[, color, ...])

Arranges points in clusters and scatters them and their cluster labels.

spine.vis.cluster.scatter_clusters(points: ndarray, clusts: list[ndarray], color: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, hovertext: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, single_trace: bool = False, name: str | list[str] | None = None, mode: str = 'scatter', cmin: float | None = None, cmax: float | None = None, shared_legend: bool = True, **kwargs: Any) list[plotly.graph_objs.Scatter3d] | list[plotly.graph_objs.Mesh3d][source]

Arranges points in clusters and scatters them and their cluster labels.

Produces plotly.graph_objs.Scatter3d trace object to be drawn in plotly. The object is nested to be fed directly to a plotly.graph_objs.Figure or plotly.offline.iplot(). All of the regular plotly parameters are available.

Parameters:
  • points (np.ndarray) – (N, 3) array of N points of (…, x, y, z,…) coordinate information

  • clusts (List[np.ndarray]) –

    1. List of cluster indexes

  • color (Union[str, int, float, Sequence], optional) – Color of the markers, provided either as one shared scalar value, one value per point, one value per cluster, or pre-grouped per-cluster point values in "scatter" mode.

  • hovertext (Union[int, float, str, Sequence], optional) – Hover labels, provided either as one shared scalar label, one label per point, one label per cluster, or pre-grouped per-cluster labels in "scatter" mode.

  • single_trace (bool, default False) – If True, combine all clusters into a single plotly trace

  • name (Union[str, List[str]], optional) – Name of the clusters or of each cluster

  • mode (str, default 'scatter') – Drawing mode; one of ‘circle’, ‘scatter’, ‘ellipsoid’, ‘cone’ or ‘hull’

  • cmin (float, optional) – Minimum value along the color scale

  • cmax (float, optional) – Maximum value along the color scale

  • shared_legend (bool, default True) – If True put all cluster traces under a single shared legend

  • **kwargs (dict, optional) – List of additional arguments to pass to plotly.graph_objs.Scatter3D

Returns:

(1/C) List with one combined trace or one trace per cluster

Return type:

Union[List[go.Scatter3d], List[go.Mesh3d]]