peach.pl.dotplot#
- peach.pl.dotplot(results_df, *, x_col='archetype', y_col='gene', size_col='mean_archetype', color_col='pvalue', top_n_per_group=10, filter_zero_p=True, log_transform_p=True, max_log_p=300.0, title='Gene-Archetype Associations', figsize=(12, 8), color_palette='plasma', save_path=None, **kwargs)[source]#
Create dotplot visualization for statistical results.
Creates publication-ready dotplot showing statistical test results with effect sizes encoded as dot size and significance as color.
- Parameters:
results_df (pd.DataFrame) β Statistical test results from pc.tl.gene_associations(), pc.tl.pathway_associations(), or pc.tl.pattern_analysis().
x_col (str, default: "archetype") β Column for x-axis (groups).
y_col (str, default: "gene") β Column for y-axis (features).
size_col (str, default: "mean_archetype") β Column for dot size (effect magnitude).
color_col (str, default: "pvalue") β Column for dot color (significance).
top_n_per_group (int, default: 10) β Number of top results per group.
filter_zero_p (bool, default: True) β Whether to filter out p-values of exactly 0.
log_transform_p (bool, default: True) β Whether to apply -log10 transformation to p-values.
max_log_p (float, default: 300.0) β Maximum -log10(p-value) cap.
title (str, default: "Gene-Archetype Associations") β Plot title.
figsize (tuple[float, float], default: (12, 8)) β Figure size as (width, height).
color_palette (str, default: "plasma") β Matplotlib colormap name.
save_path (str | None, default: None) β Path to save the figure.
**kwargs β Additional arguments passed to create_dotplot_visualization.
- Returns:
Dotplot figure with: - X-axis: Groups (archetypes/patterns) - Y-axis: Features (genes/pathways), sorted by effect size - Dot size: Effect magnitude (with legend) - Dot color: -log10(p-value) (with colorbar) - Background panels grouping features by archetype
- Return type:
Notes
Auto-detects result type and adjusts columns: - Gene results: Uses defaults - Pathway results: Switches y_col to βpathwayβ - Pattern results: Uses pattern_name, effect_range - Exclusivity results: Uses tradeoff_score, effect_range
Examples
>>> gene_results = pc.tl.gene_associations(adata) >>> fig = pc.pl.dotplot(gene_results) >>> plt.show()
>>> # Pathway results (auto-detected) >>> pathway_results = pc.tl.pathway_associations(adata) >>> fig = pc.pl.dotplot(pathway_results, title="Pathway Associations")