Plotting¶
The plotting module provides visualization functions for ecological data.
Ordination Plots¶
- nuee.plotting.plot_ordination(result: OrdinationResult, axes: Tuple[int, int] = (0, 1), display: str = 'sites', choices: List[int] | None = None, type: str = 'points', groups: ndarray | Series | None = None, colors: List[str] | None = None, figsize: Tuple[int, int] = (8, 6), scaling: int | str | None = None, title: str | None = None, **kwargs) Figure[source]¶
Plot ordination results.
- Parameters:
result – OrdinationResult object
axes – Which axes to plot
display – What to display (“sites”, “species”, “both”)
choices – Alternative way to specify axes
type – Plot type (“points”, “text”, “none”)
groups – Grouping factor for coloring points
colors – Colors for groups
figsize – Figure size
**kwargs – Additional plotting arguments
- Returns:
matplotlib Figure object
- nuee.plotting.biplot(result: OrdinationResult, axes: Tuple[int, int] = (0, 1), scaling: str | int = 'species', correlation: bool = False, figsize: Tuple[int, int] = (10, 8), title: str | None = None, arrow_mul: float | None = None, n_species: int | None = 15, show_site_labels: bool = True, show_species_labels: bool = True, repel: bool = True, fontsize: int = 8, site_kw: Dict[str, Any] | None = None, species_kw: Dict[str, Any] | None = None, env_kw: Dict[str, Any] | None = None, groups: ndarray | Series | list | None = None, color_by: ndarray | Series | list | None = None, cmap: str | None = None, **kwargs) Figure[source]¶
Create a biplot for ordination results.
For unconstrained ordination (PCA, CA, LDA), species loadings are drawn as arrows from the origin. For constrained ordination (RDA / CCA), species are shown as points and environmental variables as arrows.
- Parameters:
result (OrdinationResult) – Ordination result object.
axes (tuple of int) – Which ordination axes to plot (0-indexed).
scaling (str or int) – Scaling mode: 1/”sites”, 2/”species”, 3/”symmetric”.
correlation (bool) – If True, use raw correlation values without auto-scaling.
title (str, optional) – Plot title.
arrow_mul (float, optional) – Manual multiplier for arrow length.
n_species (int or None) – Show only the top n_species by loading magnitude.
Noneshows all species.show_site_labels (bool) – Whether to display site name labels.
show_species_labels (bool) – Whether to display species name labels.
repel (bool) – Use adjustText for ggrepel-style label placement.
fontsize (int) – Base font size for labels.
site_kw (dict, optional) – Extra keyword arguments for site scatter points.
species_kw (dict, optional) – Extra keyword arguments for species scatter/arrows.
env_kw (dict, optional) – Extra keyword arguments for environmental arrows.
groups (array-like, optional) – Categorical group labels (one per site) for coloured scatter. Auto-detected from LDA results.
color_by (array-like, optional) – Continuous values (one per site) for colour-mapped scatter with a colourbar. Mutually exclusive with groups.
cmap (str, optional) – Matplotlib colormap name. Default is the colour cycle for groups (up to 10) and
"viridis"for color_by.**kwargs – Additional keyword arguments passed to site scatter.
- nuee.plotting.ordiplot(result: OrdinationResult, axes: Tuple[int, int] = (0, 1), display: str = 'sites', figsize: Tuple[int, int] = (8, 6), scaling: int | str | None = None, **kwargs) Figure[source]¶
Basic ordination plot.
- Parameters:
result – OrdinationResult object
axes – Which axes to plot
display – What to display (“sites”, “species”, “both”)
figsize – Figure size
**kwargs – Additional plotting arguments
- Returns:
matplotlib Figure object
Diversity Plots¶
- nuee.plotting.plot_diversity(diversity_data: ndarray | Series | DataFrame | DiversityResult, figsize: tuple = (8, 6), **kwargs) Figure[source]¶
Plot diversity indices.
- Parameters:
diversity_data – Diversity values
figsize – Figure size
**kwargs – Additional plotting arguments
- Returns:
matplotlib Figure object
- nuee.plotting.plot_rarecurve(rarecurve_data: Dict[str, Dict[str, ndarray]], figsize: tuple = (10, 6), **kwargs) Figure[source]¶
Plot rarefaction curves.
- Parameters:
rarecurve_data – Rarefaction curve data
figsize – Figure size
**kwargs – Additional plotting arguments
- Returns:
matplotlib Figure object
Dissimilarity Plots¶
- nuee.plotting.plot_dissimilarity(distance_matrix: ndarray | DataFrame, figsize: tuple = (8, 6), **kwargs) Figure[source]¶
Plot dissimilarity matrix as heatmap.
- Parameters:
distance_matrix – Distance/dissimilarity matrix
figsize – Figure size
**kwargs – Additional plotting arguments
- Returns:
matplotlib Figure object