opendvp.plotting.density

Contents

opendvp.plotting.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.

Return type:

Figure | None

Parameters:#

adataAnnData

Annotated data matrix.

color_bystr

Column in adata.obs to group/hue by.

color_dictdict, optional

Dictionary mapping group names (values in adata.obs[color_by]) to colors.

return_figbool, optional

If True, returns the matplotlib Figure object for further customization. If False, shows the plot.

axmatplotlib.axes.Axes, optional

Axes object to plot on. If None, a new figure and axes are created.

**kwargs

Additional keyword arguments passed to seaborn.kdeplot.

Returns:#

figmatplotlib.figure.Figure or None

The figure object if return_fig is True, otherwise None.