sccloud.composition_plot

sccloud.composition_plot(adata, by, condition, stacked=True, normalize=True, stats=True, **kwds)[source]

Generate a composition plot, which shows the percentage of observations from every condition within each cluster (by).

Parameters
  • adata (AnnData) – Annotated data matrix.

  • by (str) – Key for accessing variables of adata.var_names or a field of adata.obs used to group the data.

  • condition (str) – Key for accessing variables of adata.var_names or a field of adata.obs used to compute counts within a group.

  • reduce_function – Function used to summarize condition groups

  • stacked (bool) – Whether bars are stacked.

  • normalize (bool) – Normalize counts within each group to sum to one.

  • stats (bool) – Compute statistics for each group using the fisher exact test when condition has two groups and the chi square test otherwise.

Return type

Element