dandelion.polars.plotting.stackedbarplot

dandelion.polars.plotting.stackedbarplot(data, color, group_by, figsize=(8, 3), normalize=False, title=None, sort_descending=True, xtick_fontsize=None, xtick_rotation=None, hide_legend=False, legend_options=('upper left', (1, 1), 1), labels=None, min_clone_size=1, clone_key=None, **kwargs)[source]

A stacked bar plot function to plot usage of V/J genes in the data split by groups.

Parameters:
  • data (AnnData | Dandelion) – Dandelion or AnnData object.

  • color (str) – column name in metadata for plotting in bar plot.

  • group_by (str | None) – column name in metadata to split by during plotting.

  • figsize (tuple[float, float], optional) – figure size.

  • normalize (bool, optional) – if True, will return as proportion out of 1, otherwise False will return counts.

  • title (str | None, optional) – title of plot.

  • sort_descending (bool, optional) – whether or not to sort the order of the plot.

  • xtick_fontsize (int | None, optional) – size of x tick labels

  • xtick_rotation (int | float | None, optional) – rotation of x tick labels.

  • hide_legend (bool, optional) – whether or not to hide the legend.

  • legend_options (tuple[str, tuple[float, float], int], optional) – a tuple holding 3 options for specify legend options: 1) loc (string), 2) bbox_to_anchor (tuple), 3) ncol (int).

  • labels (list[str] | None, optional) – Names of objects will be used for the legend if list of multiple data frames supplied.

  • min_clone_size (int, optional) – minimum clone size to keep.

  • clone_key (str | None, optional) – column name for clones. None defaults to ‘clone_id’.

  • **kwargs – other kwargs passed to matplotlib.plt.

Returns:

stacked barplot.

Return type:

tuple[Figure, Axes]