pegasus.composition_plot

pegasus.composition_plot(adata, by, condition, stacked=True, normalize=True, condition_sort_by=None, cmap=None, **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.

  • stacked (bool) – Whether bars are stacked.

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

  • condition_sort_by (Optional[str]) – Sort condition within each group by max, mean, natsorted, or None.

  • cmap (Union[str, List[str], Tuple[str], None]) – Color map name (hv.plotting.list_cmaps()) or a list of hex colors. See http://holoviews.org/user_guide/Styling_Plots.html for more information.

Return type

Element