scallops.visualize.histogram.in_situ_barcode_hist_plot
- scallops.visualize.histogram.in_situ_barcode_hist_plot(reads_df, counts=(0, 1, 2, 3, 4, 5), hue=None, normalize=True, **fig_kw)
Generate a histogram plot depicting the percentage of cells containing barcode reads. This function takes a DataFrame with read tables and plots a histogram showing the distribution of cells based on the number of barcode reads.
- Parameters:
reads_df (DataFrame) – DataFrame containing read tables from the output reads folder.
counts (Sequence[int] | None) – Optional list of histogram bins.
hue (str) – Grouping variable for the second layer of grouping.
normalize (bool) – Whether to normalize counts.
fig_kw – Additional keyword arguments passed to .pyplot.figure call.
- Returns:
Returns the Axes object with the plot drawn onto it.
- Example:
from scallops.visualize import in_situ_barcode_hist_plot import pandas as pd import numpy as np data = { "well": np.random.choice(["A", "B", "C", "D"], size=100), "label": np.random.choice(range(1, 10), size=100), "barcode_match": np.random.choice([True, False], size=100), } reads_df = pd.DataFrame(data) in_situ_barcode_hist_plot( reads_df, counts=[0, 1, 2, 3], hue="well", normalize=True )
- Return type:
Axes