voyagerpy.plotting.plot_barcode_histogram#

voyagerpy.plotting.plot_barcode_histogram(adata: AnnData, feature: str | Sequence[str], color_by: str | None = None, figsize: Tuple[float, float] | None = None, ncol: int = 1, cmap: str | None = None, bins: int = 100, log: bool = True, stacked: bool = False, histtype: str = 'step', obsm: str | None = None, label: Sequence[str] | None = None, subplot_kwargs: Dict[str, Any] | None = None, **hist_kwargs) ndarray[Any, dtype[Axes]]#

Create a histogram of the number of barcodes per feature.

Deprecated since version 0.1.1: figsize will be removed in a future version. Use subplot_kwargs instead.

Parameters:
  • adata (AnnData) – The annotated data matrix.

  • feature (Union[str, Sequence[str]]) – The feature or features to plot. The feature must be present in the dataframe of choice.

  • color_by (Optional[str], optional) – The column name to color the plots by, by default None

  • figsize (Optional[Tuple[float, float]], optional) – The size of the figure, by default None

  • ncol (int, optional) – The number of columns in the axes grid, by default 1

  • cmap (Optional[str], optional) – The colormap to use, by default None

  • bins (int, optional) – The number of bins to use in the histogram, by default 100

  • log (bool, optional) – Use log-scale, by default True

  • stacked (bool, optional) – Create a stacked histogram, by default False

  • histtype (str, optional) – The type of histogram to use, by default “step”. See matplotlib.pyplot.hist() for more information. Additionally, "line" is supported, which creates a line plot through the histogram bins.

  • obsm (Optional[str], optional) – If not None, use this obsm as the dataframe to plot, otherwise use adata.obs, by default None.

  • label (Optional[Sequence[str]], optional) – The labels to show on the x-axis of each subplot. Must be None or be a list of str have the length of the number of features, by default None.

  • subplot_kwargs (Optional[Dict[str, Any]], optional) – Keyword arguments supplied to subplots_single_colorbar(), by default None

Returns:

The axes drawn on.

Return type:

npt.NDArray[Axes]

Raises:
  • KeyError – If obsm is not in adata.obsm.

  • ValueError – If the number of labels does not match the number of features.