mechanochat.plotting.forceij_plot#

mechanochat.plotting.forceij_plot(sem: SEM2, cid_i: Iterable[int], cid_j: None | Iterable[int] = None, fx_csr: None | csr_array = None, fy_csr: None | csr_array = None, ax: Axes | None = None, reciprocal: bool = True, width_bin=None, fmin: float = 1e-1, rotation: Dict | None = None, **quiver_kwargs) → Axes[source]#

Plot intercellular forces between elements of selected cells using quiver arrows.

For each element in cid_i, computes the total force exerted by elements in cid_j and renders it as a quiver arrow. Arrow length is scaled by log(1 + force magnitude).

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

  • cid_i (iterable of int) – Cell indices acting as force receivers. When cid_j is None, each cell in cid_i is treated as receiver against all remaining cells in cid_i.

  • cid_j (iterable of int, optional) – Cell indices acting as force senders. If None, pairwise forces within cid_i are visualized (each cell vs. all others in the list).

  • fx_csr (csr_array, optional) – Precomputed x-component force sparse matrix. Computed from sem if not provided.

  • fy_csr (csr_array, optional) – Precomputed y-component force sparse matrix. Computed from sem if not provided.

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

  • reciprocal (bool, default True) – If True and cid_j is provided, also plot the reciprocal forces from cid_i elements back onto cid_j elements.

  • width_bin (array-like, optional) – Force magnitude bin boundaries for variable arrow width. If None, a single arrow width is used scaled by log(1 + force magnitude).

  • fmax (float, default 1) – Upper bound for force magnitude scaling (currently unused in log scaling mode).

  • fmin (float, default 1e-1) – Minimum force magnitude threshold; elements with force below this value are hidden.

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

  • **quiver_kwargs – Additional keyword arguments passed to ax.quiver().

Returns:

ax (Axes)