View source: R/NPT_continuous_plot.R
| NPT_continuous_plot | R Documentation |
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.
NPT_continuous_plot(pca_obj, group = NULL, default_fill = "#1373D3")
pca_obj |
The PCA result object from |
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). |
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)
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
The function requires the result object from NPT_continuous()
A larger plotting window is recommended for better visualization
Arrow labels show dimension names (e.g., "pc1.grow", "pc2.survive")
The function uses max.overlaps = Inf to show all labels
Group colors are automatically assigned if groups are provided
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.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.