mechanochat.plotting.spatial_domain_comm_plot#
- mechanochat.plotting.spatial_domain_comm_plot(sem: SEM2, df_pvalue: DataFrame, cluster_key: str, ax: Axes | None = None, threshold: float = 0.05, loop_angle_default: float = 0, node_size: float = 1.8, loop_size: float = 3.5, arror_size: float = 25, arrowstyle=ArrowStyle('-|>', head_width=0.2), color='black', edge_width: float = 3.2, node_line_width: float = 1) Axes[source]#
Draw the significant communication between spatial domains on top of the tissue.
Every spatial domain is drawn as a square node placed on the cell of that domain closest to its centroid, and a significant ordered pair gets an arrow between the two nodes; a significant diagonal entry gets a self-loop, oriented away from the other edges of that node.
- Parameters:
sem (
SEM2) – Subcellular element method object. Requires sem.adata.obs[cluster_key], sem.adata.obs[f’{cluster_key}_mc’] (the spatial domain of each cell) and sem.adata.uns[f’{cluster_key}_colors’]df_pvalue (
pandas.DataFrame) – Square p-value matrix indexed by spatial domain, e.g. adata.uns[…][‘communication_pvalue’]. Rows are targets, columns are sourcescluster_key (
str) – Key of the cell type annotation in .obs; the node colors are taken from itax (
Axes, optional) – Target matplotlib axes object. Creates new figure if Nonethreshold (
float, default0.05) – Significance threshold; only the pairs below it are drawnloop_angle_default (
float, default0) – Angle (radians) of the self-loop of a node with no other edgenode_size (
float, default1.8) – Side length of the node squares, in spatial unitsloop_size (
float, default3.5) – Area controlling the radius of the self-loopsarror_size (
float, default25) – Arrow head size (mutation_scale of FancyArrowPatch)arrowstyle (
ArrowStyle) – Arrow head style. DefaultArrowStyle('-|>', head_width=0.2)color (
color, default'black') – Color of the edges and arrow headsedge_width (
float, default3.2) – Line width of the edgesnode_line_width (
float, default1) – Line width of the node borders
- Returns:
ax (
Axes)
Notes
Domains with fewer than 5 cells are skipped.