count_plot()
Plot normalized or absolute counts with optional grouping.
Usage
count_plot(
df,
norm_control,
conditions,
condition_col="condition",
selector_col="cell_line",
selector_val=None,
plot_type=PlotType.NORMALISED,
show_triplicates=False,
show_boxes=True,
repeat_offset=0.18,
title=None,
colors=COLOR,
save=False,
save_stats=False,
dpi=300,
tight_layout=False,
file_format="pdf",
path=None,
fig_size=(7, 7),
size_units="cm",
axes=None,
group_size=1,
within_group_spacing=0.2,
between_group_gap=0.5,
x_label=True,
paired=True,
show_ns=True,
min_effect=None,
normalise_within_plate=True
)This is a backward-compatible wrapper around the simplified architecture.
Data Filtering df : pd.DataFrame The dataframe to plot containing single-cell measurements. norm_control : str The control condition to normalize by (required even for absolute plots). conditions : list[str] The conditions to plot. condition_col : str, default=“condition” The column name for the conditions. selector_col : str | None, default=“cell_line” The column name for the selector. selector_val : str | None, default=None The value of the selector.
Display Options ^ plot_type : PlotType, default=PlotType.NORMALISED The type of plot to create (NORMALISED or ABSOLUTE). show_triplicates : bool, default=False If True, show individual bars per replicate plate instead of the mean bar with overlay points. show_boxes : bool, default=True Whether to draw boxes around triplicates (only applies when show_triplicates=True). repeat_offset : float, default=0.18 Offset between replicate bars (only applies when show_triplicates=True).
Grouping & Layout ^ group_size : int, default=1 The number of conditions to group together. paired : bool, default=True Use a paired t-test (ttest_rel, matched by plate_id) for significance; set False for the unpaired ttest_ind. normalise_within_plate : bool, default=True Test the per-plate log fold-change ln(cond/control) vs 0 rather than the absolute count difference. Removes a multiplicative plate baseline so significance tracks effect size, not control stability. Requires paired=True; set False for the legacy absolute-count test. within_group_spacing : float, default=0.2 The spacing between conditions within a group. between_group_gap : float, default=0.5 The gap between groups.
Styling & Colors title : str | None, default=None The title of the plot. colors : Any, default=COLOR The colors to use for the plot. x_label : bool, default=True Whether to show x-axis labels. axes : Axes | None, default=None The axis to plot on.
Layout & Sizing ^ fig_size : tuple[float, float], default=(7, 7) The size of the plot. size_units : str, default=“cm” The units of the plot size.
Save Options save : bool, default=False Whether to save the plot. save_stats : bool, default=False Write {title}_stats.csv and {title}_medians.csv to path (independent of save; works when plotting onto a provided/composed axes). path : Path | None, default=None The path to save the plot. file_format : str, default=“pdf” The format of the plot. tight_layout : bool, default=False Whether to use tight layout. dpi : int, default=300 The resolution of the plot.
tuple[Figure, Axes] The figure and axes objects.