scPyviewer.plot_composition#

scPyviewer.plot_composition(ds, group=None, split=None, figsize=(7.6, 4.4), dpi=150, normalize=True, palette=None, bar_width=0.8, sort_groups=False, edgecolor='black', edge_width=0.6, title=None, title_fontsize=11, xlabel=None, ylabel=None, xlabel_fontsize=9, ylabel_fontsize=9, tick_fontsize=8, rotation=30, legend_fontsize=6, legend_title_fontsize=7, font_family=None)[source]#

Stacked bar of group composition across split categories.

Parameters:
  • group (str, optional) – Cell-type / cluster column (defaults to ds.group_key).

  • split (str, optional) – Sample / condition column to split bars by. Auto-selected if None.

  • figsize (tuple) – Figure (width, height) in inches.

  • dpi (int) – Figure resolution.

  • normalize (bool) – Show fractions (True) or raw counts (False).

  • palette (dict, optional) – {label: color} override.

  • bar_width (float) – Bar width (0–1).

  • sort_groups (bool) – Sort stacked groups alphabetically.

  • edgecolor (str or None) – Outline colour for each bar segment (default "black" for a crisp, print-ready look). Pass None for borderless flat bars.

  • edge_width (float) – Bar outline line width when edgecolor is set.

  • title (str, optional) – Override figure title.

  • title_fontsize (float) – Title font size.

  • ylabel (str | None) – Axis label overrides.

  • ylabel_fontsize (float) – Axis label font sizes.

  • tick_fontsize (float) – Tick-label font size.

  • rotation (int) – X-tick label rotation in degrees.

  • legend_fontsize (float) – Legend entry font size.

  • legend_title_fontsize (float) – Legend title font size.

  • font_family (str, optional) – Font family for this figure only.

  • ds (Dataset)

  • xlabel (str | None)

  • ylabel

  • xlabel_fontsize (float)

  • ylabel_fontsize