metachat.pl.plot_metapathway_pair_contribution_bubbleplot

metachat.pl.plot_metapathway_pair_contribution_bubbleplot(pathway_pair_contributions, pathway_name, smallest_size=10, cmap='blue', plot_title=None, figsize=(12, 5), ax=None, plot_savepath=None)[source]

Plot a bubble chart showing metabolite–sensor contributions for a selected metabolic pathway.

This function visualizes the contribution strength of metabolite–sensor pairs involved in a specific metabolic pathway as a bubble plot. Each bubble corresponds to a metabolite–sensor interaction, with color and size indicating the relative communication score. Missing or zero scores are displayed in gray bubbles with distinct outlines.

Parameters

pathway_pair_contributionsdict

This object is typically generated from mc.tl.summary_pathway()

pathway_namestr

The name of the metabolic pathway to visualize.

smallest_sizefloat, default=10

Base bubble size for missing (NA) or zero communication scores.

cmap{“blue”, “green”, “red”}, default=”blue”

Color gradient preset defining the color scale for communication scores.

plot_titlestr, optional

Custom title for the figure.

figsizetuple of float, default=(12, 5)

Figure size (width, height).

axmatplotlib.axes.Axes, optional

Existing Matplotlib axis to draw on. If None, a new figure and axis are created.

plot_savepathstr, optional

File path to save the figure (e.g., "pathway_bubbleplot.pdf"). The format is inferred from the file extension. If None, the plot is displayed interactively without saving.

Returns

axmatplotlib.axes.Axes

Matplotlib axis containing the generated bubble plot.

Notes

  • This function visualizes pathway-level MCC contributions, and is typically used after running pathway aggregation steps within MetaChat analysis.

  • Bubbles are categorized into quantile-based bins (≤1/3, 1/3–2/3, >2/3 quantiles) with increasing color intensity and bubble size.

  • Missing or zero values are shown in gray to distinguish from active interactions.

  • Legends indicate bubble categories corresponding to relative contribution scores.