opendvp.pl.density#
- density(adata, color_by, color_dict=None, return_fig=False, ax=None, **kwargs)#
Plot density (KDE) plots of protein abundance grouped by a categorical variable in AnnData.obs.
- Parameters:
adata (anndata.AnnData) – Annotated data matrix.
color_by (str) – Column in adata.obs to group/hue by.
color_dict (dict, optional) – Dictionary mapping group names (values in adata.obs[color_by]) to colors.
return_fig (bool, optional) – If True, returns the matplotlib Figure object for further customization. If False, shows the plot.
ax (matplotlib.axes.Axes, optional) – Axes object to plot on. If None, a new figure and axes are created.
**kwargs (
Any) – Additional keyword arguments passed to seaborn.kdeplot.
- Returns:
fig – The figure object if return_fig is True, otherwise None.
- Return type:
matplotlib.figure.Figure or None