sccoda.util.data_visualization.boxplots

sccoda.util.data_visualization.boxplots(data, feature_name, y_scale='relative', plot_facets=False, add_dots=False, cell_types=None, args_boxplot={}, args_swarmplot={}, figsize=None, dpi=100, cmap='Blues', plot_legend=True, level_order=None)

Grouped boxplot visualization. The cell counts for each cell type are shown as a group of boxplots, with intra–group separation by a covariate from data.obs.

The cell type groups can either be ordered along the x-axis of a single plot (plot_facets=False) or as plot facets (plot_facets=True).

Parameters
data : AnnDataAnnData

A scCODA-compatible data object

feature_name : strstr

The name of the feature in data.obs to plot

y_scale : strstr (default: 'relative')

Transformation to of cell counts. Options: “relative” - Relative abundance, “log” - log(count), “count” - absolute abundance (cell counts)

plot_facets : boolbool (default: False)

If False, plot cell types on the x-axis. If True, plot as facets

add_dots : boolbool (default: False)

If True, overlay a scatterplot with one dot for each data point

cell_types : list, NoneOptional[list] (default: None)

Subset of cell types that should be plotted

args_boxplot : dict, NoneOptional[dict] (default: {})

Arguments passed to sns.boxplot

args_swarmplot : dict, NoneOptional[dict] (default: {})

Arguments passed to sns.swarmplot

figsize : Tuple[int, int], NoneOptional[Tuple[int, int]] (default: None)

figure size

dpi : int, NoneOptional[int] (default: 100)

dpi setting

cmap : str, NoneOptional[str] (default: 'Blues')

The seaborn color map for the barplot

plot_legend : bool, NoneOptional[bool] (default: True)

If True, adds a legend

level_order : List[str], NoneOptional[List[str]] (default: None)

Custom ordering of bars on the x-axis

Return type

Tuple[Axes, FacetGrid], NoneOptional[Tuple[Axes, FacetGrid]]

Returns

  • Depending on plot_facets, returns a AxesSubplot (plot_facets = False) or FacetGrid (plot_facets = True) object

  • ax – if plot_facets = False

  • g – if plot_facets = True