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 objectvis_key (
str, optional) – Key to retrieve visualization data from sem.adata.arr (
np.ndarrayorpd.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 cellscmap_name (
str, default'Reds') – Valid matplotlib colormap name to visualize datavmax (
float, optional) – Colormap upper bound. Default: data maxvmin (
float, optional) – Colormap lower bound. Default: data minspot_size (
float, default1) – Markersize for matplotlib.pyplot.scatterscaling (
bool, defaultTrue) – Scale coordinates back to original data(xc) if True, otherwise visualize directly.enable_legend (
bool, defaultFalse) – Show categorical legend (only for category data).enable_colorbar (
bool, defaultFalse) – Show colorbar (only for continuous data).ax (
Axes, optional) – Target matplotlib axes object. Creates new figure if Nonesave_name (
str, optional) – Output path for figure saving (e.g., ‘figure.pdf’)show (
bool, defaultTrue) – Keep the figure open after saving. Ignored when save_name is Nonerotation (
dict, optional) – Rotate the coordinates before plotting. Keys: ‘center’ (2,) and ‘theta’ (radians)
- Returns:
ax (
Axes)