.n_samples_per_category
- proteopy.pl.n_samples_per_category(adata, category_key, categories=None, ignore_na=False, ascending=False, order=None, xlabel_rotation=45.0, color_scheme=None, figsize=(6.0, 4.0), show=True, save=None, ax=False)[source]
Plot sample (obs) counts per category (optionally stratified).
- Parameters:
adata (anndata.AnnData) – Annotated data matrix with categorical obs annotations.
category_key (str | Sequence[str]) – One or two column names in
adata.obsused to stratify observations.categories (Sequence[Any] | None) – Labels from the first category column to display on the x-axis. Rows whose first-column value is not listed are dropped.
ignore_na (bool) – Drop observations with missing labels when
True; otherwise, missing values are shown as"missing".ascending (bool) – Sort categories by total counts when no explicit order is supplied.
Trueplaces lower counts on the left.order (Sequence[Any] | None) – Explicit order for the x-axis labels (values of the first category column). Any levels not listed are appended afterwards in their intrinsic order. When provided,
ascendingis ignored.xlabel_rotation (float) – Rotation angle (degrees) applied to the x-axis tick labels.
color_scheme (Any | None) – Mapping, sequence, colormap name, or callable used to colour categories.
figsize (tuple[float, float]) – Figure size (width, height) in inches used for
matplotlib.pyplot.subplots().show (bool) – Call
matplotlib.pyplot.show()whenTrue.save (str | Path | None) – Save the figure to the provided path (
strorPath`).
- Return type: