mechanochat.plotting.element_plot#

mechanochat.plotting.element_plot(sem: SEM2, vis_key: str | None = None, arr: ndarray[Any, dtype[_ScalarType_co]] | Series | None = None, summary: str = 'sender', cid_list: ndarray[Any, dtype[int64]] | ndarray[Any, dtype[bool_]] | Sequence[int] | None = None, cmap_name: str = 'Reds', vmax: float | None = None, vmin: float | None = None, spot_size: float = 1, scaling: bool = True, show_axis: bool = True, enable_colorbar: bool = True, enable_legend: bool = True, ax: Axes | None = None, save_name: str | None = None, show: bool = True, rotation: Dict | None = None) → Axes[source]#

Plotting cell elements

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

  • vis_key (str, optional) – Key to retrieve visualization data from sem.adata.

  • arr (np.ndarray or pd.Series, optional) – Data for visualization. Accepts both cell-level (nc,) and element-level (ne,)

  • summary (str, default 'sender') –

    ‘sender’ represents sender signal, retrieves data from adata.obsm[‘sender_signal’][vis_key]

    ’receiver’ retrieves receiver signal data from adata.obsm[‘receiver_signal’][vis_key]

    ’gene’ retrieves gene expression data from adata

  • cid_list (ndarray, optional) – Array of index for cells to be visualized. Default: all cells

  • cmap_name (str, default 'Reds') – Valid matplotlib colormap name to visualize data

  • vmax (float, optional) – Colormap upper bound. Default: data max

  • vmin (float, optional) – Colormap lower bound. Default: data min

  • spot_size (float, default 1) – Markersize for matplotlib.pyplot.scatter

  • scaling (bool, default True) – Scale coordinates back to original data(xc) if True, otherwise visualize directly.

  • show_axis (bool, default True) – Show axis.

  • enable_legend (bool, default False) – Show categorical legend (only for category data).

  • enable_colorbar (bool, default False) – Show colorbar (only for continuous data).

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

  • save_name (str, optional) – Output path for figure saving (e.g., ‘figure.pdf’)

  • show (bool, default True) – Keep the figure open after saving. Ignored when save_name is None

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

Returns:

ax (Axes)