mechanochat.plotting.contact_plot#

mechanochat.plotting.contact_plot(ctri: cell_tri_dev, vis_key: Literal['mechanical interaction', 'tension', 'tension1'], mean_edge_value: bool = True, line_width: float = 2, cid_list: ndarray[Any, dtype[int64]] | ndarray[Any, dtype[bool_]] | Sequence[int] | None = None, pair_list: ndarray[Any, dtype[int64]] | None = None, norm: Normalize | None = None, cmap_name: str = 'inferno', show_axis: bool = False, ax: Axes | None = None, rotation: Dict | None = None, return_norm: bool = False)[source]#

Plot cell-cell contact mechanical signals as colored line segments.

Requires contact_analysis to be run beforehand on the ctri object.

Parameters:
  • ctri (cell_tri or cell_tri_dev) – Cell triangulation object containing contact geometry and force data

  • vis_key ({'mechanical interaction', 'tension', 'tension1'}) –

    Signal to visualize:

    • 'mechanical interaction' — cell-cell mechanical interaction force (also renders junction segments separately)

    • 'tension' — contact edge tension

    • 'tension1' — mean tension per contact pair

  • mean_edge_value (bool, default True) – If True, assign the mean signal value uniformly to all segments of each contact edge; if False, use per-segment values

  • line_width (float, default 2) – Width of the contact line segments

  • cid_list (array-like, optional) – Cell indices to include. Default: all cells

  • pair_list (ndarray of shape (n, 2), optional) – Restrict display to specific cell-pair indices. Default: all pairs

  • norm (Normalize, optional) – Matplotlib normalization object for colormap mapping. Default: 5th–95th percentile of the signal

  • cmap_name (str, default 'inferno') – Valid matplotlib colormap name

  • show_axis (bool, default False) – Show axis

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

  • rotation (dict, optional) –

    Rotate coordinates before plotting. Expected keys:

    • 'center' — rotation center, array of shape (2,)

    • 'theta' — rotation angle in radians

  • return_norm (bool, default False) – If True, also return the normalization object and colormap

Returns:

  • ax (Axes) – If return_norm=False

  • (ax, norm, cmap) (tuple) – If return_norm=True