mechanochat.plotting.highlight_cell#

mechanochat.plotting.highlight_cell(sem: SEM2, cid_list, color: tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float], ax: Axes | None = None, ns: int = 8, r: float = 10., ar: float | None = None, face_alpha: float = 0.1, edge_alpha: float = 0.9, lw: float = 1.5, zorder: int = 2, rotation: Dict | None = None, scaling: bool = True, show_axis: bool = True)[source]#

Highlight a group of cells with a unified color overlay using alpha shape.

Parameters:
  • sem (SEM) – Subcellular element method object

  • cid_list (array-like) – Cell indices to highlight. Accepts int, bool array, or list of indices. If None, all cells are selected.

  • color (color) –

    Highlight color. Accepts:

    • Named color string, e.g. 'r', 'blue'

    • Hex string, e.g. '#FF5733'

    • RGB array/list/tuple with values in [0, 1], e.g. [0.2, 0.6, 0.8]

  • ax (Axes, optional) – Target matplotlib axes object. Creates new figure if None.

  • ns (int, default 8) – Number of elements per segment used by AlphaShape

  • r (float, default 10.0) – Neighbor search radius for AlphaShape

  • ar (float, optional) – Alpha radius controlling the concavity of the outline. Default: the largest alpha radius among the selected cells, which follows the cell shapes closely

  • face_alpha (float, default 0.1) – Face opacity of the highlighted region, 0 (fully transparent), 1 (fully opaque)

  • edge_alpha (float, default 0.9) – Edge opacity of the highlighted region, 0 (fully transparent), 1 (fully opaque)

  • lw (float, default 1.5) – Boundary line width

  • zorder (int, default 2) – Matplotlib draw order of the overlay

  • rotation (dict, optional) – Rotate the coordinates before plotting. Keys: ‘center’ (2,) and ‘theta’ (radians)

  • scaling (bool, default True) – If True, transform element coordinates from simulation space to spatial units

  • show_axis (bool, default True) – Show axis

Returns:

ax (Axes)