omicverse.pl.plot_grouped_fractions

omicverse.pl.plot_grouped_fractions(res, obs, group_key, color_dict=None, agg='mean', normalize=True, figsize=(4, 4))[source]

Plot grouped cell-fraction summaries as stacked bars.

Parameters:
  • res (pd.DataFrame) – Predicted cell-fraction matrix with samples as rows and cell types as columns.

  • obs (pd.DataFrame) – Sample metadata table aligned to res index.

  • group_key (str) – Metadata column used to group samples (for example severity/condition).

  • color_dict (dict or None) – Mapping from cell-type names to colors. If provided, column order follows keys.

  • agg (str) – Group aggregation method: 'mean', 'median', or 'sum'.

  • normalize (bool) – Whether each grouped row is normalized to sum to 1.

  • figsize (tuple) – Figure size passed to pandas/matplotlib plotting backend.

Returns:

Axes containing the grouped stacked-bar chart.

Return type:

matplotlib.axes.Axes