cellcycle_plot()
Plot cell cycle phases in a 2x2 subplot grid with statistical analysis.
Usage
cellcycle_plot(
df,
conditions,
condition_col="condition",
selector_col="cell_line",
selector_val=None,
title=None,
fig_size=(6, 6),
size_units="cm",
colors=None,
save=True,
save_stats=False,
path=None,
tight_layout=False,
file_format="pdf",
dpi=300,
show_significance=True,
show_repeat_points=True,
rotation=45,
cc_phases=True,
show_subG1=False,
show_plate_legend=False,
paired=True,
show_ns=True,
min_effect=None
)This is a backward-compatible wrapper around the new class-based architecture. Creates a 2x2 subplot grid showing each cell cycle phase (G1, S, G2/M, Polyploid) separately with repeat points and significance marks.
Notes
Unlike other plot functions, this returns (Figure, list of Axes) because it creates multiple subplots that cannot be collapsed into a single axis.
Data Filtering df : pd.DataFrame DataFrame containing cell cycle data with required columns: ‘cell_cycle’, ‘plate_id’, and condition_col. conditions : list[str] List of condition names to plot. condition_col : str, default=“condition” Column name for experimental condition. selector_col : str | None, default=“cell_line” Column name for selector (e.g., cell line). selector_val : str | None, default=None Value to filter selector_col by.
Display Options ^ cc_phases : bool, default=True If True, use cell cycle terminology {Sub-G1, G1, S, G2/M, Polyploid}. If False, use DNA content terminology {<2N, 2N, S, 4N, >4N}. show_subG1 : bool, default=False Whether to include Sub-G1/<2N phase in the plot. show_significance : bool, default=True Whether to show significance marks (requires ≥3 plates). paired : bool, default=True Use a paired t-test (ttest_rel, matched by plate_id) per phase; set False for the unpaired ttest_ind. show_repeat_points : bool, default=True Whether to show individual repeat points. show_plate_legend : bool, default=False Whether to show legend with different shapes for each plate_id.
Styling & Colors title : str | None, default=None Plot title. If None, generates default title. fig_size : tuple[float, float], default=(6, 6) Dimensions of the figure. size_units : str, default=“cm” Units of the figure size (“cm” or “inch”). colors : list[str] | None, default=None List of colors for plotting. If None, uses default phase colors: G1=PINK, S=LIGHT_BLUE, G2/M=YELLOW, Polyploid=BLUE. rotation : int, default=45 Rotation angle for x-axis labels. tight_layout : bool, default=False Whether to use tight layout.
Save Options save : bool, default=True Whether to save the figure. 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 : Optional[Path], default=None Path to save the figure. file_format : str, default=“pdf” Format of the figure (“pdf”, “png”, “svg”, etc.). dpi : int, default=300 Resolution of the figure.
tuple[Figure, list] The figure object and list of 4 axes objects [top-left, top-right, bottom-left, bottom-right].
>>> fig, axes = cellcycle_plot(
... df=data,
... conditions=["control", "treatment"],
... selector_val="MCF10A",
... save=False
... )
>>> plt.show()>>> # Custom colors
>>> fig, axes = cellcycle_plot(
... df=data,
... conditions=["ctrl", "drug1", "drug2"],
... colors=["red", "green", "blue", "purple"],
... title="Custom Cell Cycle Analysis"
... )