peach.pl.pattern_dotplot

peach.pl.pattern_dotplot#

peach.pl.pattern_dotplot(pattern_df, pattern_type=None, top_n=20, min_effect_size=0.5, max_pvalue=0.05, figsize=(12, 8), title=None, save_path=None, **kwargs)[source]#

Create dotplot for pattern analysis results.

Visualizes the top features (pathways/genes) for each pattern, showing effect sizes and significance levels.

Parameters:
  • pattern_df (pd.DataFrame) – Results from archetype_exclusive_patterns, specialization_patterns, or tradeoff_patterns functions.

  • pattern_type (str, optional) – Type of pattern for title generation (“exclusive”, “specialization”, “tradeoff”). If None, inferred from data.

  • top_n (int, default: 20) – Number of top features to show.

  • min_effect_size (float, default: 0.5) – Minimum absolute effect size to include.

  • max_pvalue (float, default: 0.05) – Maximum p-value to include.

  • figsize (tuple, default: (12, 8)) – Figure size.

  • title (str, optional) – Custom title. If None, auto-generated based on pattern_type.

  • save_path (str, optional) – Path to save the figure.

  • **kwargs – Additional arguments passed to create_dotplot_visualization.

Returns:

Dotplot figure with: - X-axis: Pattern codes or archetype names - Y-axis: Feature names (genes/pathways) - Dot size: Effect size magnitude - Dot color: -log10(p-value) (significance)

Returns placeholder figure with message if input is empty or no features pass filters.

Return type:

matplotlib.figure.Figure

Examples

>>> exclusive = pc.tl.archetype_exclusive_patterns(adata)
>>> fig = pc.pl.pattern_dotplot(exclusive, pattern_type="exclusive")
>>> tradeoffs = pc.tl.tradeoff_patterns(adata, tradeoffs="pairs")
>>> fig = pc.pl.pattern_dotplot(tradeoffs, min_effect_size=1.0, top_n=30, title="Strong Tradeoff Patterns")