insitupy.plotting.cell_abundance_along_axis#
- insitupy.plotting.cell_abundance_along_axis(adata, axis, groupby=None, xlim=(0, inf), savepath=None, figsize=(8, 6), save_only=False, dpi_save=300, multiple='stack', histplot_element='bars', kde=False, verbose=True)#
Plot cell abundance along a specified axis.
This function visualizes the distribution of cells along a continuous variable (e.g., pseudotime, spatial coordinate) using histograms or KDE plots. It supports grouping by a categorical variable and allows customization of the histogram style.
- Parameters:
adata (
AnnData) – AnnData object containing single-cell data.axis (
Union[str,Tuple[str,str]]) – Key for the x-axis. Can be a column inadata.obsor a tuple (obsm_key, obsm_col) for accessing values fromadata.obsm.groupby (
Optional[str] (default:None)) – Column inadata.obsto group cells by. Defaults to None.xlim (
Tuple(default:(0, inf))) – Range of x-axis values to include. Defaults to (0, np.inf).savepath (
Optional[PathLike] (default:None)) – Path to save the figure. If None, the figure is not saved.figsize (
Tuple(default:(8, 6))) – Size of the figure in inches. Defaults to (8, 6).save_only (
bool(default:False)) – If True, saves the figure without displaying it. Defaults to False.dpi_save (
int(default:300)) – Resolution (DPI) for saving the figure. Defaults to 300.multiple (
Literal['layer','dodge','stack','fill'] (default:'stack')) – How to display multiple groups. Defaults to “stack”.histplot_element (
Literal['bars','step','poly'] (default:'bars')) – Style of histogram elements. Defaults to “bars”.kde (
bool(default:False)) – If True, plots KDE instead of histogram. Defaults to False.verbose (
bool(default:True)) – If True, prints progress messages. Defaults to True.
- Returns:
Displays and/or saves the generated plot.
- Return type:
None