.n_cat1_per_cat2_hist

proteopy.pl.n_cat1_per_cat2_hist(adata, first_category, second_category, axis, bin_width=None, bin_range=None, figsize=(6.0, 4.0), show=True, save=None, ax=False)[source]

Plot the distribution of the number of first-category entries per second category.

Parameters:
  • adata (AnnData) – Annotated data matrix.

  • second_category (str) – Column name identifying the primary category. Resolved from adata.obs when axis == 0 and adata.var when axis == 1. Passing "index" is not supported.

  • first_category (str) – Column providing the secondary category from the same axis as second_category. Pass "index" to use adata.obs_names (axis == 0) or adata.var_names (axis == 1).

  • axis (int) – 0 to work on adata.obs, 1 to work on adata.var.

  • bin_width (float | None) – Optional histogram bin width. Must be positive when provided.

  • bin_range (tuple[float, float] | None) – Optional tuple (lower, upper) limiting the histogram bins. lower must be strictly smaller than upper.

  • figsize (tuple[float, float]) – Size (width, height) in inches passed to matplotlib.pyplot.subplots().

  • show (bool) – Call matplotlib.pyplot.show() when True.

  • save (str | Path | None) – Save the figure to the provided path when given.

  • ax (bool) – Return the Axes instance instead of displaying the plot.

Return type:

Axes | None