plot_habitat_feature_effect

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

plot_habitat_feature_effect(comparison: HabitatFeatureComparison, *, pair: Tuple[int, int] | None = None, habitats: Sequence[int] | None = None, features: Sequence[str] | None = None, top_k: int = 20, max_features: int = 15, title: str | None = None) → Figure[source]

Habitat-pair effect sizes (Cliff’s delta or Cohen’s d).

Default (no pair): a features x pair heatmap of every habitat pair (H1-H2, H1-H3, …). Colour is the effect size; BH q < 0.05 cells are starred and full-colour, others stay pale. When more features exist than max_features, only the top-k by max absolute effect across pairs are drawn and the title states the truncation (top 15 of 47 by max |delta|). If that heatmap would still be too tall, compare habitats on a few CVA/PCA component scores instead (plot_habitat_feature_components()).

Single-pair lollipop: pass pair=(a, b) or habitats=(a, b). Filled markers are BH q < 0.05; open markers are not significant or untested. The x-axis is symmetric so negative effects keep numeric ticks.

The delta / d formula is the domain compare; this function only draws it.

Parameters:
  • comparison – Output of compare_habitat_features.

  • pair – Explicit (habitat_a, habitat_b) for the lollipop.

  • habitats – Habitat ids. Two ids = the same as pair; three or more (or omitted) = all pairs among those ids.

  • features – Optional explicit feature list (heatmap rows).

  • top_k – Maximum features on the single-pair lollipop.

  • max_features – Heatmap row cap when features is omitted (default 15).

  • title – Optional figure title.

Returns:

The matplotlib Figure.