Learn R Programming

MultiTraits (version 0.6.0)

NPT_continuous_plot: Plot Continuous Niche Classification Results

Description

This function creates a biplot visualization of the continuous niche classification results from the hierarchical Principal Component Analysis. It displays species ordination in niche space with optional grouping and shows the contribution of different niche dimensions as arrows.

Usage

NPT_continuous_plot(pca_obj, group = NULL, default_fill = "#1373D3")

Value

A ggplot2 object containing the biplot visualization with:

  • Points representing species/samples in the ordination space

  • Arrows showing the direction and magnitude of niche dimension contributions

  • Labels for niche dimensions (arrows)

  • Variance explained by PC1 and PC2 in axis labels

  • Optional color coding by groups if provided

Arguments

pca_obj

The PCA result object from NPT_continuous()$result, which should be a vegan rda object containing the second-level PCA results that integrate all niche dimensions into a unified ordination space.

group

Optional vector specifying group membership for each species/sample. If provided, points will be colored by group. If NULL (default), all points will have the same color. Length should match the number of rows in the original data.

default_fill

Character string specifying the default fill color when no grouping is applied. Default is "#1373D3" (blue).

Details

The function creates a standard PCA biplot where:

  • Points represent species positioned in the integrated niche space

  • Red arrows represent the niche dimensions (from first-level PCAs) and their relative contribution to the ordination axes

  • Arrow length indicates the strength of correlation with the ordination axes

  • Arrow direction shows the gradient direction in niche space

  • Dashed reference lines at x=0 and y=0 help interpret the ordination

The plot helps interpret:

  • Species clustering patterns in niche space

  • Which niche dimensions drive the main gradients

  • Relationships between different niche dimensions

  • Group differences in niche occupation (when groups are specified)

References

  1. Winemiller, K. O., Fitzgerald, D. B., Bower, L. M., & Pianka, E. R. (2015). Functional traits, convergent evolution, and periodic tables of niches. Ecology letters, 18(8), 737-751.

  2. Yu, R., Huang, J., Xu, Y., Ding, Y., & Zang, R. (2020). Plant functional niches in forests across four climatic zones: Exploring the periodic table of niches based on plant functional traits. Frontiers in Plant Science, 11, 841.

Examples

Run this code
data(PFF)
PFF[,4:21] <- log(PFF[,4:21])
PFF <- na.omit(PFF)
traits_dimension <- list(
  grow = c("SLA","SRL","Leaf_Nmass","Root_Nmass"),
  survive = c("Height","Leaf_CN","Root_CN"),
  reproductive = c("SeedMass","FltDate","FltDur")
)
npt_result <- NPT_continuous(data = PFF, dimension = traits_dimension)
NPT_continuous_plot(npt_result$result)
NPT_continuous_plot(npt_result$result, PFF$family)

Run the code above in your browser using DataLab