nichesphere.niche_stats.plot_internal_external_boxplots

nichesphere.niche_stats.plot_internal_external_boxplots#

nichesphere.niche_stats.plot_internal_external_boxplots(g: Graph, partition: dict, ax=None)#

Box plots of signed edge weights (internal vs external) per community.

For each detected niche/community, two side-by-side box plots show the distribution of signed edge weights for edges connecting nodes within the community (internal, blue) and edges connecting nodes across communities (external, orange). Positive weights represent enriched co-localization; the plot therefore visualises how cohesive each niche is relative to its cross-niche connections.

Parameters:
  • g (nx.Graph) – Signed co-localization network (output of nichesphere.coloc.colocNW()).

  • partition (dict) – Mapping of node → community name (e.g. vc_map_named).

  • ax (matplotlib.axes.Axes or None, default None) – Axes to draw on; a new figure is created when None.

Returns:

ax – The axes containing the box plots.

Return type:

matplotlib.axes.Axes